2011-02-21 07:25:24 +00:00
|
|
|
/*
|
2008-01-01 18:29:19 +00:00
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
2010-02-12 13:34:04 +00:00
|
|
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2008-01-01 18:29:19 +00:00
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2008 Blender Foundation.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Contributor(s): Blender Foundation
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*/
|
2011-02-21 07:25:24 +00:00
|
|
|
|
|
|
|
/** \file ED_object.h
|
|
|
|
* \ingroup editors
|
|
|
|
*/
|
|
|
|
|
2012-02-17 18:59:41 +00:00
|
|
|
#ifndef __ED_OBJECT_H__
|
|
|
|
#define __ED_OBJECT_H__
|
2008-01-01 18:29:19 +00:00
|
|
|
|
2010-10-05 00:05:14 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2008-12-29 12:15:42 +00:00
|
|
|
struct Base;
|
2012-01-22 10:20:30 +00:00
|
|
|
struct EnumPropertyItem;
|
2012-07-25 19:45:34 +00:00
|
|
|
struct ID;
|
2010-08-01 12:47:49 +00:00
|
|
|
struct Main;
|
2009-05-21 15:36:16 +00:00
|
|
|
struct ModifierData;
|
2010-08-01 12:47:49 +00:00
|
|
|
struct Object;
|
|
|
|
struct ReportList;
|
|
|
|
struct Scene;
|
2012-10-10 03:13:02 +00:00
|
|
|
struct bConstraint;
|
|
|
|
struct bContext;
|
|
|
|
struct bPoseChannel;
|
2010-08-01 12:47:49 +00:00
|
|
|
struct wmKeyConfig;
|
|
|
|
struct wmKeyMap;
|
|
|
|
struct wmOperator;
|
|
|
|
struct wmOperatorType;
|
2013-06-23 15:37:08 +00:00
|
|
|
struct PointerRNA;
|
|
|
|
struct PropertyRNA;
|
|
|
|
struct EnumPropertyItem;
|
|
|
|
|
2009-01-30 15:01:14 +00:00
|
|
|
/* object_edit.c */
|
2012-01-02 17:15:24 +00:00
|
|
|
struct Object *ED_object_context(struct bContext *C); /* context.object */
|
|
|
|
struct Object *ED_object_active_context(struct bContext *C); /* context.object or context.active_object */
|
2010-03-31 00:55:01 +00:00
|
|
|
|
|
|
|
/* object_ops.c */
|
2008-12-23 19:47:33 +00:00
|
|
|
void ED_operatortypes_object(void);
|
2009-10-12 12:54:08 +00:00
|
|
|
void ED_operatormacros_object(void);
|
Key Configuration
Keymaps are now saveable and configurable from the user preferences, note
that editing one item in a keymap means the whole keymap is now defined by
the user and will not be updated by Blender, an option for syncing might be
added later. The outliner interface is still there, but I will probably
remove it.
There's actually 3 levels now:
* Default builtin key configuration.
* Key configuration loaded from .py file, for configs like Blender 2.4x
or other 3D applications.
* Keymaps edited by the user and saved in .B.blend. These can be saved
to .py files as well to make creating distributable configurations
easier.
Also, user preferences sections were reorganized a bit, now there is:
Interface, Editing, Input, Files and System.
Implementation notes:
* wmKeyConfig was added which represents a key configuration containing
keymaps.
* wmKeymapItem was renamed to wmKeyMapItem for consistency with wmKeyMap.
* Modal maps are not wrapped yet.
* User preferences DNA file reading did not support newdataadr() yet,
added this now for reading keymaps.
* Key configuration related settings are now RNA wrapped.
* is_property_set and is_property_hidden python methods were added.
2009-10-08 18:40:03 +00:00
|
|
|
void ED_keymap_object(struct wmKeyConfig *keyconf);
|
2008-12-23 19:47:33 +00:00
|
|
|
|
2012-01-22 10:20:30 +00:00
|
|
|
/* object_relations.c */
|
|
|
|
typedef enum eParentType {
|
|
|
|
PAR_OBJECT,
|
|
|
|
PAR_ARMATURE,
|
|
|
|
PAR_ARMATURE_NAME,
|
|
|
|
PAR_ARMATURE_ENVELOPE,
|
|
|
|
PAR_ARMATURE_AUTO,
|
|
|
|
PAR_BONE,
|
2013-02-12 14:42:46 +00:00
|
|
|
PAR_BONE_RELATIVE,
|
2012-01-22 10:20:30 +00:00
|
|
|
PAR_CURVE,
|
|
|
|
PAR_FOLLOW,
|
|
|
|
PAR_PATH_CONST,
|
|
|
|
PAR_LATTICE,
|
|
|
|
PAR_VERTEX,
|
2015-06-23 17:35:55 +02:00
|
|
|
PAR_VERTEX_TRI,
|
2012-01-22 10:20:30 +00:00
|
|
|
} eParentType;
|
|
|
|
|
2012-10-10 03:13:02 +00:00
|
|
|
#ifdef __RNA_TYPES_H__
|
2012-01-22 10:20:30 +00:00
|
|
|
extern struct EnumPropertyItem prop_clear_parent_types[];
|
|
|
|
extern struct EnumPropertyItem prop_make_parent_types[];
|
2012-10-10 03:13:02 +00:00
|
|
|
#endif
|
2012-01-22 10:20:30 +00:00
|
|
|
|
2014-10-10 18:26:46 +02:00
|
|
|
bool ED_object_parent_set(struct ReportList *reports, struct Main *bmain, struct Scene *scene, struct Object *ob,
|
|
|
|
struct Object *par, int partype, const bool xmirror, const bool keep_transform,
|
|
|
|
const int vert_par[3]);
|
|
|
|
void ED_object_parent_clear(struct Object *ob, const int type);
|
2012-05-29 18:12:13 +00:00
|
|
|
struct Base *ED_object_scene_link(struct Scene *scene, struct Object *ob);
|
2012-01-22 10:20:30 +00:00
|
|
|
|
2012-05-30 08:02:49 +00:00
|
|
|
void ED_keymap_proportional_cycle(struct wmKeyConfig *keyconf, struct wmKeyMap *keymap);
|
|
|
|
void ED_keymap_proportional_obmode(struct wmKeyConfig *keyconf, struct wmKeyMap *keymap);
|
2012-06-04 16:42:58 +00:00
|
|
|
void ED_keymap_proportional_maskmode(struct wmKeyConfig *keyconf, struct wmKeyMap *keymap);
|
2012-05-30 08:02:49 +00:00
|
|
|
void ED_keymap_proportional_editmode(struct wmKeyConfig *keyconf, struct wmKeyMap *keymap,
|
2014-03-31 23:39:08 +11:00
|
|
|
const bool do_connected);
|
2009-10-13 15:30:19 +00:00
|
|
|
|
2012-05-12 20:39:39 +00:00
|
|
|
/* send your own notifier for select! */
|
2008-12-29 12:15:42 +00:00
|
|
|
void ED_base_object_select(struct Base *base, short mode);
|
2012-05-12 20:39:39 +00:00
|
|
|
/* includes notifier */
|
2008-12-29 13:02:18 +00:00
|
|
|
void ED_base_object_activate(struct bContext *C, struct Base *base);
|
2008-12-29 12:15:42 +00:00
|
|
|
|
2010-08-01 12:47:49 +00:00
|
|
|
void ED_base_object_free_and_unlink(struct Main *bmain, struct Scene *scene, struct Base *base);
|
2008-12-30 13:16:14 +00:00
|
|
|
|
2012-08-11 22:12:32 +00:00
|
|
|
/* single object duplicate, if (dupflag == 0), fully linked, else it uses the flags given */
|
2010-08-01 12:47:49 +00:00
|
|
|
struct Base *ED_object_add_duplicate(struct Main *bmain, struct Scene *scene, struct Base *base, int dupflag);
|
2009-01-05 15:19:31 +00:00
|
|
|
|
2014-10-10 18:26:46 +02:00
|
|
|
void ED_object_parent(struct Object *ob, struct Object *parent, const int type, const char *substr);
|
2009-01-05 15:19:31 +00:00
|
|
|
|
2013-08-29 10:34:09 +00:00
|
|
|
bool ED_object_mode_compat_set(struct bContext *C, struct Object *ob, int mode, struct ReportList *reports);
|
2009-08-15 18:58:01 +00:00
|
|
|
void ED_object_toggle_modes(struct bContext *C, int mode);
|
|
|
|
|
2009-01-01 18:05:12 +00:00
|
|
|
/* bitflags for enter/exit editmode */
|
2012-05-12 20:39:39 +00:00
|
|
|
#define EM_FREEDATA 1
|
|
|
|
#define EM_FREEUNDO 2
|
|
|
|
#define EM_WAITCURSOR 4
|
|
|
|
#define EM_DO_UNDO 8
|
|
|
|
#define EM_IGNORE_LAYER 16
|
2013-03-21 14:18:17 +00:00
|
|
|
void ED_object_editmode_exit(struct bContext *C, int flag);
|
|
|
|
void ED_object_editmode_enter(struct bContext *C, int flag);
|
2013-03-21 14:12:04 +00:00
|
|
|
bool ED_object_editmode_load(struct Object *obedit);
|
2008-12-30 13:16:14 +00:00
|
|
|
|
2015-02-23 23:05:54 +11:00
|
|
|
bool ED_object_editmode_calc_active_center(struct Object *obedit, const bool select_only, float r_center[3]);
|
|
|
|
|
2012-05-26 22:21:56 +00:00
|
|
|
void ED_object_location_from_view(struct bContext *C, float loc[3]);
|
2014-01-16 23:50:35 +11:00
|
|
|
void ED_object_rotation_from_view(struct bContext *C, float rot[3], const char align_axis);
|
2012-05-26 22:21:56 +00:00
|
|
|
void ED_object_base_init_transform(struct bContext *C, struct Base *base, const float loc[3], const float rot[3]);
|
2015-02-10 02:38:21 +11:00
|
|
|
float ED_object_new_primitive_matrix(
|
|
|
|
struct bContext *C, struct Object *editob,
|
|
|
|
const float loc[3], const float rot[3], float primmat[4][4]);
|
2009-12-28 04:09:46 +00:00
|
|
|
|
2015-06-21 16:06:44 +02:00
|
|
|
|
|
|
|
/* Avoid allowing too much insane values even by typing (typos can hang/crash Blender otherwise). */
|
|
|
|
#define OBJECT_ADD_SIZE_MAXF 1.0e12f
|
|
|
|
|
2013-09-16 00:18:09 +00:00
|
|
|
void ED_object_add_unit_props(struct wmOperatorType *ot);
|
|
|
|
void ED_object_add_generic_props(struct wmOperatorType *ot, bool do_editmode);
|
Fix T37879: Default UV generation for mesh primitives.
Adds default-generated UVs to mesh primitives (cone, cylinder, icosphere, uvsphere, cube, circle, grid)
when they are added to the scene, since some of them can be pretty awkward to unwrap manually.
Original patch: Liam Mitchell (CommanderCorianderSalamander).
Main review work: Campbell Barton (campbellbarton).
Finalization, fixes and cleanup: Bastien Montagne (mont29).
Reviewers: mont29, #mesh_modeling, campbellbarton
Reviewed By: mont29, campbellbarton
Subscribers: lkruel, campbellbarton, michaelknubben, kevindietrich
Maniphest Tasks: T37879
Differential Revision: https://developer.blender.org/D481
2015-12-04 23:49:55 +01:00
|
|
|
void ED_object_add_mesh_props(struct wmOperatorType *ot);
|
2014-01-16 23:50:35 +11:00
|
|
|
bool ED_object_add_generic_get_opts(struct bContext *C, struct wmOperator *op, const char view_align_axis,
|
|
|
|
float loc[3], float rot[3],
|
2013-09-16 00:18:09 +00:00
|
|
|
bool *enter_editmode, unsigned int *layer, bool *is_view_aligned);
|
2011-05-01 18:53:18 +00:00
|
|
|
|
2014-09-01 20:09:31 +10:00
|
|
|
struct Object *ED_object_add_type(
|
2015-05-04 12:25:33 +10:00
|
|
|
struct bContext *C,
|
|
|
|
int type, const char *name, const float loc[3], const float rot[3],
|
|
|
|
bool enter_editmode, unsigned int layer)
|
|
|
|
ATTR_NONNULL(1) ATTR_RETURNS_NONNULL;
|
2009-01-05 15:19:31 +00:00
|
|
|
|
2014-10-10 18:26:46 +02:00
|
|
|
void ED_object_single_users(struct Main *bmain, struct Scene *scene, const bool full, const bool copy_groups);
|
2013-04-24 23:09:25 +00:00
|
|
|
void ED_object_single_user(struct Main *bmain, struct Scene *scene, struct Object *ob);
|
2008-01-01 18:29:19 +00:00
|
|
|
|
2010-01-19 11:31:49 +00:00
|
|
|
/* object motion paths */
|
2016-02-26 01:07:26 +13:00
|
|
|
void ED_objects_clear_paths(struct bContext *C, bool only_selected);
|
2010-01-19 11:31:49 +00:00
|
|
|
void ED_objects_recalculate_paths(struct bContext *C, struct Scene *scene);
|
|
|
|
|
2009-01-10 19:34:23 +00:00
|
|
|
/* constraints */
|
2009-05-27 00:03:49 +00:00
|
|
|
struct ListBase *get_active_constraints(struct Object *ob);
|
2014-03-16 03:24:05 +11:00
|
|
|
struct ListBase *get_constraint_lb(struct Object *ob, struct bConstraint *con, struct bPoseChannel **r_pchan);
|
2009-05-27 00:03:49 +00:00
|
|
|
struct bConstraint *get_active_constraint(struct Object *ob);
|
|
|
|
|
|
|
|
void object_test_constraints(struct Object *ob);
|
|
|
|
|
|
|
|
void ED_object_constraint_set_active(struct Object *ob, struct bConstraint *con);
|
2009-09-24 21:22:24 +00:00
|
|
|
void ED_object_constraint_update(struct Object *ob);
|
2013-02-22 00:51:58 +00:00
|
|
|
void ED_object_constraint_dependency_update(struct Main *bmain, struct Object *ob);
|
2009-01-10 19:34:23 +00:00
|
|
|
|
2015-03-19 18:28:49 +05:00
|
|
|
void ED_object_constraint_tag_update(struct Object *ob, struct bConstraint *con);
|
|
|
|
void ED_object_constraint_dependency_tag_update(struct Main *bmain, struct Object *ob, struct bConstraint *con);
|
|
|
|
|
2.5: Object module
* Split object_edit.c into multiple files:
object_add.c, object_edit.c, object_hook.c, object_relations.c,
object_select.c, object_transform.c.
* Rename files to have consistent object_ and mball_ prefix:
object_shapekey.c, object_lattice.c, object_vgroup.c, mball_edit.c.
* Added operators:
* vertex group menu and set active
* apply location, rotation, scale, visual transform (location is new)
* make local
* make vertex parent
* move to layer
* convert to curve/mesh (not finished yet)
* Many small fixes for marked issues, but still much code to be cleaned
up here...
2009-09-09 11:52:56 +00:00
|
|
|
/* object_lattice.c */
|
2015-11-18 12:20:28 +11:00
|
|
|
bool ED_lattice_select_pick(struct bContext *C, const int mval[2], bool extend, bool deselect, bool toggle);
|
2010-11-17 09:45:45 +00:00
|
|
|
void undo_push_lattice(struct bContext *C, const char *name);
|
2009-01-13 15:18:41 +00:00
|
|
|
|
2009-11-29 22:16:29 +00:00
|
|
|
/* object_lattice.c */
|
|
|
|
|
2015-11-18 12:20:28 +11:00
|
|
|
void ED_lattice_flags_set(struct Object *obedit, int flag);
|
2009-11-29 22:16:29 +00:00
|
|
|
|
2009-05-21 15:34:09 +00:00
|
|
|
/* object_modifier.c */
|
2009-11-22 13:44:09 +00:00
|
|
|
enum {
|
2012-05-12 20:39:39 +00:00
|
|
|
MODIFIER_APPLY_DATA = 1,
|
2011-09-10 09:38:38 +00:00
|
|
|
MODIFIER_APPLY_SHAPE
|
|
|
|
};
|
2009-11-22 13:44:09 +00:00
|
|
|
|
2012-05-26 22:21:56 +00:00
|
|
|
struct ModifierData *ED_object_modifier_add(struct ReportList *reports, struct Main *bmain, struct Scene *scene,
|
|
|
|
struct Object *ob, const char *name, int type);
|
2014-02-01 01:45:09 +11:00
|
|
|
bool ED_object_modifier_remove(struct ReportList *reports, struct Main *bmain,
|
|
|
|
struct Object *ob, struct ModifierData *md);
|
2013-02-22 00:51:58 +00:00
|
|
|
void ED_object_modifier_clear(struct Main *bmain, struct Object *ob);
|
2009-05-21 15:34:09 +00:00
|
|
|
int ED_object_modifier_move_down(struct ReportList *reports, struct Object *ob, struct ModifierData *md);
|
|
|
|
int ED_object_modifier_move_up(struct ReportList *reports, struct Object *ob, struct ModifierData *md);
|
2016-12-28 17:30:58 +01:00
|
|
|
int ED_object_modifier_convert(struct ReportList *reports, struct Main *bmain, struct Scene *scene,
|
|
|
|
struct Object *ob, struct ModifierData *md);
|
2012-05-26 22:21:56 +00:00
|
|
|
int ED_object_modifier_apply(struct ReportList *reports, struct Scene *scene,
|
|
|
|
struct Object *ob, struct ModifierData *md, int mode);
|
2009-05-21 15:34:09 +00:00
|
|
|
int ED_object_modifier_copy(struct ReportList *reports, struct Object *ob, struct ModifierData *md);
|
2009-01-10 19:34:23 +00:00
|
|
|
|
2014-02-01 01:45:09 +11:00
|
|
|
bool ED_object_iter_other(struct Main *bmain, struct Object *orig_ob, const bool include_orig,
|
|
|
|
bool (*callback)(struct Object *ob, void *callback_data),
|
|
|
|
void *callback_data);
|
2012-06-24 20:18:32 +00:00
|
|
|
|
2014-02-01 01:45:09 +11:00
|
|
|
bool ED_object_multires_update_totlevels_cb(struct Object *ob, void *totlevel_v);
|
2012-06-24 20:18:32 +00:00
|
|
|
|
2012-10-10 03:13:02 +00:00
|
|
|
/* object_select.c */
|
2012-07-25 19:45:34 +00:00
|
|
|
void ED_object_select_linked_by_id(struct bContext *C, struct ID *id);
|
|
|
|
|
2013-06-23 15:37:08 +00:00
|
|
|
struct EnumPropertyItem *ED_object_vgroup_selection_itemf_helper(
|
|
|
|
const struct bContext *C,
|
|
|
|
struct PointerRNA *ptr,
|
|
|
|
struct PropertyRNA *prop,
|
2014-01-04 18:08:43 +11:00
|
|
|
bool *r_free,
|
2013-06-23 15:37:08 +00:00
|
|
|
const unsigned int selection_mask);
|
2013-06-12 09:52:37 +00:00
|
|
|
|
2013-11-19 17:19:06 +06:00
|
|
|
void ED_object_check_force_modifiers(struct Main *bmain, struct Scene *scene, struct Object *object);
|
|
|
|
|
2010-10-05 00:05:14 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-02-17 18:59:41 +00:00
|
|
|
#endif /* __ED_OBJECT_H__ */
|