2008-12-23 19:47:33 +00:00
|
|
|
/**
|
|
|
|
* $Id:
|
|
|
|
*
|
|
|
|
* ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
*
|
|
|
|
* The Original Code is Copyright (C) 2008 Blender Foundation.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Contributor(s): Blender Foundation
|
|
|
|
*
|
|
|
|
* ***** END GPL LICENSE BLOCK *****
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <math.h>
|
|
|
|
|
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
|
|
|
#include "DNA_object_types.h"
|
|
|
|
#include "DNA_scene_types.h"
|
|
|
|
#include "DNA_screen_types.h"
|
|
|
|
#include "DNA_space_types.h"
|
|
|
|
#include "DNA_userdef_types.h"
|
|
|
|
#include "DNA_view3d_types.h"
|
|
|
|
#include "DNA_windowmanager_types.h"
|
|
|
|
|
|
|
|
#include "BLI_arithb.h"
|
|
|
|
#include "BLI_blenlib.h"
|
|
|
|
|
|
|
|
#include "BKE_context.h"
|
|
|
|
#include "BKE_global.h"
|
|
|
|
#include "BKE_utildefines.h"
|
|
|
|
|
|
|
|
#include "RNA_access.h"
|
|
|
|
#include "RNA_define.h"
|
|
|
|
|
|
|
|
#include "WM_api.h"
|
|
|
|
#include "WM_types.h"
|
|
|
|
|
|
|
|
#include "ED_screen.h"
|
|
|
|
#include "ED_object.h"
|
|
|
|
|
|
|
|
#include "object_intern.h"
|
|
|
|
|
|
|
|
|
|
|
|
/* ************************** registration **********************************/
|
|
|
|
|
2009-01-02 03:16:38 +00:00
|
|
|
|
2008-12-23 19:47:33 +00:00
|
|
|
void ED_operatortypes_object(void)
|
|
|
|
{
|
2.5
Operator goodies!
--- Macro operators
Operators now can consist of multiple operators. Such a macro operator
is identical and behaves identical to other opererators. Macros can
also be constructed of macros even! Currently only hardcoded macros are
implemented, this to solve combined operators such as 'add duplicate' or
'extrude' (both want a transform appended).
Usage is simple:
- WM_operatortype_append_macro() : add new operatortype, name, flags
- WM_operatortype_macro_define() : add existing operator to macro
(Note: macro_define will also allow properties to be set, doesnt work
right now)
On converting the macro wmOperatorType to a real operator, it makes a
list of all operators, and the standard macro callbacks (exec, invoke,
modal, poll) just will use all.
Important note; switching to a modal operator only works as last in the
chain now!
Macros implemented for duplicate, extrude and rip. Tool menu works fine
for it, also the redo hotkey F4 works properly.
--- Operator redo fix
The operators use the undo system to switch back, but this could give
errors if other actions added undo pushes (buttons, outliner). Now the
redo for operator searches back for the correct undo level.
This fixes issues with many redos.
Note for brecht: removed the ED_undo_push for buttons... it was called
on *every* button now, which is probably too much? For example, using
the 'toolbar' redo also caused this...
2009-07-29 17:56:38 +00:00
|
|
|
wmOperatorType *ot;
|
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
|
|
|
|
|
|
|
WM_operatortype_append(OBJECT_OT_location_clear);
|
|
|
|
WM_operatortype_append(OBJECT_OT_rotation_clear);
|
|
|
|
WM_operatortype_append(OBJECT_OT_scale_clear);
|
|
|
|
WM_operatortype_append(OBJECT_OT_origin_clear);
|
|
|
|
WM_operatortype_append(OBJECT_OT_visual_transform_apply);
|
|
|
|
WM_operatortype_append(OBJECT_OT_location_apply);
|
|
|
|
WM_operatortype_append(OBJECT_OT_scale_apply);
|
|
|
|
WM_operatortype_append(OBJECT_OT_rotation_apply);
|
|
|
|
WM_operatortype_append(OBJECT_OT_center_set);
|
2.5
Operator goodies!
--- Macro operators
Operators now can consist of multiple operators. Such a macro operator
is identical and behaves identical to other opererators. Macros can
also be constructed of macros even! Currently only hardcoded macros are
implemented, this to solve combined operators such as 'add duplicate' or
'extrude' (both want a transform appended).
Usage is simple:
- WM_operatortype_append_macro() : add new operatortype, name, flags
- WM_operatortype_macro_define() : add existing operator to macro
(Note: macro_define will also allow properties to be set, doesnt work
right now)
On converting the macro wmOperatorType to a real operator, it makes a
list of all operators, and the standard macro callbacks (exec, invoke,
modal, poll) just will use all.
Important note; switching to a modal operator only works as last in the
chain now!
Macros implemented for duplicate, extrude and rip. Tool menu works fine
for it, also the redo hotkey F4 works properly.
--- Operator redo fix
The operators use the undo system to switch back, but this could give
errors if other actions added undo pushes (buttons, outliner). Now the
redo for operator searches back for the correct undo level.
This fixes issues with many redos.
Note for brecht: removed the ED_undo_push for buttons... it was called
on *every* button now, which is probably too much? For example, using
the 'toolbar' redo also caused this...
2009-07-29 17:56:38 +00:00
|
|
|
|
2009-08-16 05:48:07 +00:00
|
|
|
WM_operatortype_append(OBJECT_OT_mode_set);
|
2009-01-25 15:41:17 +00:00
|
|
|
WM_operatortype_append(OBJECT_OT_editmode_toggle);
|
2009-07-25 13:40:59 +00:00
|
|
|
WM_operatortype_append(OBJECT_OT_posemode_toggle);
|
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
|
|
|
WM_operatortype_append(OBJECT_OT_proxy_make);
|
|
|
|
WM_operatortype_append(OBJECT_OT_restrictview_clear);
|
|
|
|
WM_operatortype_append(OBJECT_OT_restrictview_set);
|
|
|
|
WM_operatortype_append(OBJECT_OT_shade_smooth);
|
|
|
|
WM_operatortype_append(OBJECT_OT_shade_flat);
|
|
|
|
|
2009-03-22 23:41:05 +00:00
|
|
|
WM_operatortype_append(OBJECT_OT_parent_set);
|
|
|
|
WM_operatortype_append(OBJECT_OT_parent_clear);
|
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
|
|
|
WM_operatortype_append(OBJECT_OT_vertex_parent_set);
|
2009-03-22 23:41:05 +00:00
|
|
|
WM_operatortype_append(OBJECT_OT_track_set);
|
|
|
|
WM_operatortype_append(OBJECT_OT_track_clear);
|
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
|
|
|
WM_operatortype_append(OBJECT_OT_slow_parent_set);
|
|
|
|
WM_operatortype_append(OBJECT_OT_slow_parent_clear);
|
|
|
|
WM_operatortype_append(OBJECT_OT_make_local);
|
|
|
|
WM_operatortype_append(OBJECT_OT_move_to_layer);
|
|
|
|
|
2009-07-08 21:31:28 +00:00
|
|
|
WM_operatortype_append(OBJECT_OT_select_inverse);
|
2009-03-24 12:16:58 +00:00
|
|
|
WM_operatortype_append(OBJECT_OT_select_random);
|
2009-03-29 02:15:13 +00:00
|
|
|
WM_operatortype_append(OBJECT_OT_select_all_toggle);
|
2009-03-24 12:16:58 +00:00
|
|
|
WM_operatortype_append(OBJECT_OT_select_by_type);
|
|
|
|
WM_operatortype_append(OBJECT_OT_select_by_layer);
|
|
|
|
WM_operatortype_append(OBJECT_OT_select_linked);
|
2009-07-11 11:31:49 +00:00
|
|
|
WM_operatortype_append(OBJECT_OT_select_grouped);
|
2009-09-03 10:42:53 +00:00
|
|
|
WM_operatortype_append(OBJECT_OT_select_mirror);
|
2009-09-16 01:15:30 +00:00
|
|
|
WM_operatortype_append(OBJECT_OT_select_name); /* XXX - weak, not compat with linked objects */
|
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
|
|
|
|
2009-01-20 03:41:23 +00:00
|
|
|
WM_operatortype_append(GROUP_OT_group_create);
|
2009-03-29 02:15:13 +00:00
|
|
|
WM_operatortype_append(GROUP_OT_objects_remove);
|
2009-01-20 10:50:36 +00:00
|
|
|
WM_operatortype_append(GROUP_OT_objects_add_active);
|
|
|
|
WM_operatortype_append(GROUP_OT_objects_remove_active);
|
2009-02-04 17:40:50 +00:00
|
|
|
|
2009-03-29 02:15:13 +00:00
|
|
|
WM_operatortype_append(OBJECT_OT_delete);
|
2009-01-25 20:22:05 +00:00
|
|
|
WM_operatortype_append(OBJECT_OT_mesh_add);
|
|
|
|
WM_operatortype_append(OBJECT_OT_curve_add);
|
2.5: Text edit mode operators back. Took me a while getting
them nicely repeatable, and splitting up the big edit_text
operator into individual operator so it's all nicely scriptable,
documented, configurable, etc..
* Insert Text, Line Break, Insert Lorem
* Toggle Case, Set Case, Toggle Style, Set Style, Set Material
* Copy Text, Cut Text, Paste Text, Paste File, Paste Buffer
* Move, Move Select, Delete
* Change Spacing, Change Character
Notes
* Text (datablock) to Object doesn't work yet, will need to
implement text editor context for that.
* Some shortcut keys don't work because screen/wm overrides them,
ctrl+x, ctrl+left/right. That override goes top down which works
well for some cases, but here we need to override in the other
direction.
* There's no unicode support in RNA, or the user interface code
for that matter, but text strings can contain these characters.
At the moment it stores a UTF-8 string in char arrays, which is
supposed to be nicely compatible with ascii. Seems reasonable to
add support for UTF-8 in the interface code, python bindings, ..
eventually?
2009-02-17 19:55:20 +00:00
|
|
|
WM_operatortype_append(OBJECT_OT_text_add);
|
2009-02-13 17:37:01 +00:00
|
|
|
WM_operatortype_append(OBJECT_OT_surface_add);
|
2009-02-18 09:28:04 +00:00
|
|
|
WM_operatortype_append(OBJECT_OT_armature_add);
|
2009-09-21 10:54:15 +00:00
|
|
|
WM_operatortype_append(OBJECT_OT_lamp_add);
|
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
|
|
|
WM_operatortype_append(OBJECT_OT_add);
|
2009-01-25 20:22:05 +00:00
|
|
|
WM_operatortype_append(OBJECT_OT_primitive_add);
|
2009-07-29 12:35:09 +00:00
|
|
|
WM_operatortype_append(OBJECT_OT_mesh_add);
|
|
|
|
WM_operatortype_append(OBJECT_OT_metaball_add);
|
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
|
|
|
WM_operatortype_append(OBJECT_OT_duplicates_make_real);
|
|
|
|
WM_operatortype_append(OBJECT_OT_duplicate);
|
|
|
|
WM_operatortype_append(OBJECT_OT_join);
|
|
|
|
WM_operatortype_append(OBJECT_OT_convert);
|
2009-04-27 18:05:58 +00:00
|
|
|
|
|
|
|
WM_operatortype_append(OBJECT_OT_modifier_add);
|
2009-07-02 19:41:31 +00:00
|
|
|
WM_operatortype_append(OBJECT_OT_modifier_remove);
|
|
|
|
WM_operatortype_append(OBJECT_OT_modifier_move_up);
|
|
|
|
WM_operatortype_append(OBJECT_OT_modifier_move_down);
|
|
|
|
WM_operatortype_append(OBJECT_OT_modifier_apply);
|
|
|
|
WM_operatortype_append(OBJECT_OT_modifier_convert);
|
|
|
|
WM_operatortype_append(OBJECT_OT_modifier_copy);
|
2009-05-23 07:12:55 +00:00
|
|
|
WM_operatortype_append(OBJECT_OT_multires_subdivide);
|
2009-09-03 17:45:04 +00:00
|
|
|
WM_operatortype_append(OBJECT_OT_multires_higher_levels_delete);
|
2009-08-21 02:51:56 +00:00
|
|
|
WM_operatortype_append(OBJECT_OT_meshdeform_bind);
|
|
|
|
WM_operatortype_append(OBJECT_OT_hook_reset);
|
|
|
|
WM_operatortype_append(OBJECT_OT_hook_recenter);
|
|
|
|
WM_operatortype_append(OBJECT_OT_hook_select);
|
|
|
|
WM_operatortype_append(OBJECT_OT_hook_assign);
|
|
|
|
WM_operatortype_append(OBJECT_OT_explode_refresh);
|
2009-05-27 00:03:49 +00:00
|
|
|
|
|
|
|
WM_operatortype_append(OBJECT_OT_constraint_add);
|
2009-07-20 12:42:31 +00:00
|
|
|
WM_operatortype_append(OBJECT_OT_constraint_add_with_targets);
|
2009-07-14 20:27:28 +00:00
|
|
|
WM_operatortype_append(POSE_OT_constraint_add);
|
2009-07-20 12:42:31 +00:00
|
|
|
WM_operatortype_append(POSE_OT_constraint_add_with_targets);
|
2009-07-19 07:20:21 +00:00
|
|
|
WM_operatortype_append(OBJECT_OT_constraints_clear);
|
|
|
|
WM_operatortype_append(POSE_OT_constraints_clear);
|
2009-07-21 04:21:07 +00:00
|
|
|
WM_operatortype_append(POSE_OT_ik_add);
|
|
|
|
WM_operatortype_append(POSE_OT_ik_clear);
|
2009-07-11 12:54:17 +00:00
|
|
|
WM_operatortype_append(CONSTRAINT_OT_delete);
|
|
|
|
WM_operatortype_append(CONSTRAINT_OT_move_up);
|
|
|
|
WM_operatortype_append(CONSTRAINT_OT_move_down);
|
2009-07-26 11:57:27 +00:00
|
|
|
WM_operatortype_append(CONSTRAINT_OT_stretchto_reset);
|
|
|
|
WM_operatortype_append(CONSTRAINT_OT_limitdistance_reset);
|
2009-07-11 11:52:20 +00:00
|
|
|
WM_operatortype_append(CONSTRAINT_OT_childof_set_inverse);
|
|
|
|
WM_operatortype_append(CONSTRAINT_OT_childof_clear_inverse);
|
2009-07-01 22:25:49 +00:00
|
|
|
|
|
|
|
WM_operatortype_append(OBJECT_OT_vertex_group_add);
|
|
|
|
WM_operatortype_append(OBJECT_OT_vertex_group_remove);
|
|
|
|
WM_operatortype_append(OBJECT_OT_vertex_group_assign);
|
|
|
|
WM_operatortype_append(OBJECT_OT_vertex_group_remove_from);
|
|
|
|
WM_operatortype_append(OBJECT_OT_vertex_group_select);
|
|
|
|
WM_operatortype_append(OBJECT_OT_vertex_group_deselect);
|
|
|
|
WM_operatortype_append(OBJECT_OT_vertex_group_copy_to_linked);
|
|
|
|
WM_operatortype_append(OBJECT_OT_vertex_group_copy);
|
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
|
|
|
WM_operatortype_append(OBJECT_OT_vertex_group_menu);
|
|
|
|
WM_operatortype_append(OBJECT_OT_vertex_group_set_active);
|
2009-07-01 22:25:49 +00:00
|
|
|
|
2009-08-26 12:51:27 +00:00
|
|
|
WM_operatortype_append(OBJECT_OT_game_property_new);
|
|
|
|
WM_operatortype_append(OBJECT_OT_game_property_remove);
|
|
|
|
|
2009-07-01 22:25:49 +00:00
|
|
|
WM_operatortype_append(OBJECT_OT_shape_key_add);
|
|
|
|
WM_operatortype_append(OBJECT_OT_shape_key_remove);
|
2009-07-03 15:23:33 +00:00
|
|
|
|
|
|
|
WM_operatortype_append(LATTICE_OT_select_all_toggle);
|
|
|
|
WM_operatortype_append(LATTICE_OT_make_regular);
|
Sorry, three commits in one, became difficult to untangle..
Editors Modules
* render/ module added in editors, moved the preview render code there and
also shading related operators.
* physics/ module made more consistent with other modules. renaming files,
making a single physics_ops.c for operators and keymaps. Also move all
particle related operators here now.
* space_buttons/ now should have only operators relevant to the buttons
specificially.
Updates & Notifiers
* Material/Texture/World/Lamp can now be passed to DAG_id_flush_update,
which will go back to a callback in editors. Eventually these should
be in the depsgraph itself, but for now this gives a unified call for
doing updates.
* GLSL materials are now refreshed on changes. There's still various
cases missing,
* Preview icons now hook into this system, solving various update cases
that were missed before.
* Also fixes issue in my last commit, where some preview would not render,
problem is avoided in the new system.
Icon Rendering
* On systems with support for non-power of two textures, an OpenGL texture
is now used instead of glDrawPixels. This avoids problems with icons get
clipped on region borders. On my Linux desktop, this gives an 1.1x speedup,
and on my Mac laptop a 2.3x speedup overall in redrawing the full window,
with the default setup. The glDrawPixels implementation on Mac seems to
have a lot of overhread.
* Preview icons are now drawn using proper premul alpha, and never faded so
you can see them clearly.
* Also tried to fix issue with texture node preview rendering, globals can't
be used with threads reliably.
2009-09-29 19:12:12 +00:00
|
|
|
|
|
|
|
WM_operatortype_append(OBJECT_OT_group_add);
|
|
|
|
WM_operatortype_append(OBJECT_OT_group_remove);
|
2.5
Operator goodies!
--- Macro operators
Operators now can consist of multiple operators. Such a macro operator
is identical and behaves identical to other opererators. Macros can
also be constructed of macros even! Currently only hardcoded macros are
implemented, this to solve combined operators such as 'add duplicate' or
'extrude' (both want a transform appended).
Usage is simple:
- WM_operatortype_append_macro() : add new operatortype, name, flags
- WM_operatortype_macro_define() : add existing operator to macro
(Note: macro_define will also allow properties to be set, doesnt work
right now)
On converting the macro wmOperatorType to a real operator, it makes a
list of all operators, and the standard macro callbacks (exec, invoke,
modal, poll) just will use all.
Important note; switching to a modal operator only works as last in the
chain now!
Macros implemented for duplicate, extrude and rip. Tool menu works fine
for it, also the redo hotkey F4 works properly.
--- Operator redo fix
The operators use the undo system to switch back, but this could give
errors if other actions added undo pushes (buttons, outliner). Now the
redo for operator searches back for the correct undo level.
This fixes issues with many redos.
Note for brecht: removed the ED_undo_push for buttons... it was called
on *every* button now, which is probably too much? For example, using
the 'toolbar' redo also caused this...
2009-07-29 17:56:38 +00:00
|
|
|
|
|
|
|
/* macros */
|
2009-09-10 14:20:21 +00:00
|
|
|
ot= WM_operatortype_append_macro("OBJECT_OT_duplicate_move", "Duplicate", OPTYPE_UNDO|OPTYPE_REGISTER);
|
2.5
Operator goodies!
--- Macro operators
Operators now can consist of multiple operators. Such a macro operator
is identical and behaves identical to other opererators. Macros can
also be constructed of macros even! Currently only hardcoded macros are
implemented, this to solve combined operators such as 'add duplicate' or
'extrude' (both want a transform appended).
Usage is simple:
- WM_operatortype_append_macro() : add new operatortype, name, flags
- WM_operatortype_macro_define() : add existing operator to macro
(Note: macro_define will also allow properties to be set, doesnt work
right now)
On converting the macro wmOperatorType to a real operator, it makes a
list of all operators, and the standard macro callbacks (exec, invoke,
modal, poll) just will use all.
Important note; switching to a modal operator only works as last in the
chain now!
Macros implemented for duplicate, extrude and rip. Tool menu works fine
for it, also the redo hotkey F4 works properly.
--- Operator redo fix
The operators use the undo system to switch back, but this could give
errors if other actions added undo pushes (buttons, outliner). Now the
redo for operator searches back for the correct undo level.
This fixes issues with many redos.
Note for brecht: removed the ED_undo_push for buttons... it was called
on *every* button now, which is probably too much? For example, using
the 'toolbar' redo also caused this...
2009-07-29 17:56:38 +00:00
|
|
|
if(ot) {
|
|
|
|
WM_operatortype_macro_define(ot, "OBJECT_OT_duplicate");
|
|
|
|
WM_operatortype_macro_define(ot, "TFM_OT_translate");
|
|
|
|
}
|
2008-12-23 19:47:33 +00:00
|
|
|
}
|
|
|
|
|
2009-09-17 21:36:02 +00:00
|
|
|
static int object_mode_poll(bContext *C)
|
|
|
|
{
|
|
|
|
Object *ob= CTX_data_active_object(C);
|
|
|
|
return (!ob || ob->mode == OB_MODE_OBJECT);
|
|
|
|
}
|
|
|
|
|
2008-12-23 19:47:33 +00:00
|
|
|
void ED_keymap_object(wmWindowManager *wm)
|
|
|
|
{
|
2009-09-17 21:36:02 +00:00
|
|
|
wmKeyMap *keymap;
|
2009-08-22 02:53:14 +00:00
|
|
|
wmKeymapItem *kmi;
|
2008-12-23 19:47:33 +00:00
|
|
|
|
2009-09-17 21:36:02 +00:00
|
|
|
keymap= WM_keymap_find(wm, "Object Non-modal", 0, 0);
|
|
|
|
|
2009-01-01 13:15:35 +00:00
|
|
|
/* Note: this keymap works disregarding mode */
|
2009-01-25 15:41:17 +00:00
|
|
|
WM_keymap_add_item(keymap, "OBJECT_OT_editmode_toggle", TABKEY, KM_PRESS, 0, 0);
|
2009-07-25 13:40:59 +00:00
|
|
|
WM_keymap_add_item(keymap, "OBJECT_OT_posemode_toggle", TABKEY, KM_PRESS, KM_CTRL, 0);
|
2009-08-22 02:53:14 +00:00
|
|
|
|
|
|
|
kmi = WM_keymap_add_item(keymap, "OBJECT_OT_mode_set", VKEY, KM_PRESS, 0, 0);
|
|
|
|
RNA_enum_set(kmi->ptr, "mode", OB_MODE_VERTEX_PAINT);
|
|
|
|
RNA_boolean_set(kmi->ptr, "toggle", 1);
|
|
|
|
kmi = WM_keymap_add_item(keymap, "OBJECT_OT_mode_set", TABKEY, KM_PRESS, KM_CTRL, 0);
|
|
|
|
RNA_enum_set(kmi->ptr, "mode", OB_MODE_WEIGHT_PAINT);
|
|
|
|
RNA_boolean_set(kmi->ptr, "toggle", 1);
|
|
|
|
|
2009-07-20 12:42:31 +00:00
|
|
|
WM_keymap_add_item(keymap, "OBJECT_OT_center_set", CKEY, KM_PRESS, KM_ALT|KM_SHIFT|KM_CTRL, 0);
|
2009-01-01 13:15:35 +00:00
|
|
|
|
|
|
|
/* Note: this keymap gets disabled in non-objectmode, */
|
2009-09-17 21:36:02 +00:00
|
|
|
keymap= WM_keymap_find(wm, "Object Mode", 0, 0);
|
|
|
|
keymap->poll= object_mode_poll;
|
2009-01-01 13:15:35 +00:00
|
|
|
|
2009-03-29 02:15:13 +00:00
|
|
|
WM_keymap_add_item(keymap, "OBJECT_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0);
|
2009-07-08 21:31:28 +00:00
|
|
|
WM_keymap_add_item(keymap, "OBJECT_OT_select_inverse", IKEY, KM_PRESS, KM_CTRL, 0);
|
2009-03-24 12:16:58 +00:00
|
|
|
WM_keymap_add_item(keymap, "OBJECT_OT_select_linked", LKEY, KM_PRESS, KM_SHIFT, 0);
|
2009-07-11 11:31:49 +00:00
|
|
|
WM_keymap_add_item(keymap, "OBJECT_OT_select_grouped", GKEY, KM_PRESS, KM_SHIFT, 0);
|
2009-09-03 10:42:53 +00:00
|
|
|
WM_keymap_add_item(keymap, "OBJECT_OT_select_mirror", MKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
|
2009-01-13 09:48:25 +00:00
|
|
|
|
2009-03-22 23:41:05 +00:00
|
|
|
WM_keymap_verify_item(keymap, "OBJECT_OT_parent_set", PKEY, KM_PRESS, KM_CTRL, 0);
|
|
|
|
WM_keymap_verify_item(keymap, "OBJECT_OT_parent_clear", PKEY, KM_PRESS, KM_ALT, 0);
|
|
|
|
WM_keymap_verify_item(keymap, "OBJECT_OT_track_set", TKEY, KM_PRESS, KM_CTRL, 0);
|
2009-07-14 20:27:28 +00:00
|
|
|
WM_keymap_verify_item(keymap, "OBJECT_OT_track_clear", TKEY, KM_PRESS, KM_ALT, 0);
|
2008-12-23 19:47:33 +00:00
|
|
|
|
2009-07-20 12:42:31 +00:00
|
|
|
WM_keymap_verify_item(keymap, "OBJECT_OT_constraint_add_with_targets", CKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
|
|
|
|
WM_keymap_verify_item(keymap, "OBJECT_OT_constraints_clear", CKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
|
2009-07-19 13:06:18 +00:00
|
|
|
|
2009-03-22 23:41:05 +00:00
|
|
|
WM_keymap_verify_item(keymap, "OBJECT_OT_location_clear", GKEY, KM_PRESS, KM_ALT, 0);
|
|
|
|
WM_keymap_verify_item(keymap, "OBJECT_OT_rotation_clear", RKEY, KM_PRESS, KM_ALT, 0);
|
|
|
|
WM_keymap_verify_item(keymap, "OBJECT_OT_scale_clear", SKEY, KM_PRESS, KM_ALT, 0);
|
|
|
|
WM_keymap_verify_item(keymap, "OBJECT_OT_origin_clear", OKEY, KM_PRESS, KM_ALT, 0);
|
2009-01-02 03:16:38 +00:00
|
|
|
|
2009-07-10 13:56:29 +00:00
|
|
|
WM_keymap_add_item(keymap, "OBJECT_OT_restrictview_clear", HKEY, KM_PRESS, KM_ALT, 0);
|
|
|
|
WM_keymap_add_item(keymap, "OBJECT_OT_restrictview_set", HKEY, KM_PRESS, 0, 0);
|
|
|
|
RNA_boolean_set(WM_keymap_add_item(keymap, "OBJECT_OT_restrictview_set", HKEY, KM_PRESS, KM_SHIFT, 0)->ptr, "unselected", 1);
|
2009-01-15 16:07:39 +00:00
|
|
|
|
2009-09-15 12:45:05 +00:00
|
|
|
WM_keymap_add_item(keymap, "OBJECT_OT_delete", XKEY, KM_PRESS, 0, 0);
|
|
|
|
WM_keymap_add_item(keymap, "OBJECT_OT_delete", DELKEY, KM_PRESS, 0, 0);
|
2009-01-25 20:22:05 +00:00
|
|
|
WM_keymap_verify_item(keymap, "OBJECT_OT_primitive_add", AKEY, KM_PRESS, KM_SHIFT, 0);
|
2.5
Operator goodies!
--- Macro operators
Operators now can consist of multiple operators. Such a macro operator
is identical and behaves identical to other opererators. Macros can
also be constructed of macros even! Currently only hardcoded macros are
implemented, this to solve combined operators such as 'add duplicate' or
'extrude' (both want a transform appended).
Usage is simple:
- WM_operatortype_append_macro() : add new operatortype, name, flags
- WM_operatortype_macro_define() : add existing operator to macro
(Note: macro_define will also allow properties to be set, doesnt work
right now)
On converting the macro wmOperatorType to a real operator, it makes a
list of all operators, and the standard macro callbacks (exec, invoke,
modal, poll) just will use all.
Important note; switching to a modal operator only works as last in the
chain now!
Macros implemented for duplicate, extrude and rip. Tool menu works fine
for it, also the redo hotkey F4 works properly.
--- Operator redo fix
The operators use the undo system to switch back, but this could give
errors if other actions added undo pushes (buttons, outliner). Now the
redo for operator searches back for the correct undo level.
This fixes issues with many redos.
Note for brecht: removed the ED_undo_push for buttons... it was called
on *every* button now, which is probably too much? For example, using
the 'toolbar' redo also caused this...
2009-07-29 17:56:38 +00:00
|
|
|
WM_keymap_add_item(keymap, "OBJECT_OT_duplicate_move", DKEY, KM_PRESS, KM_SHIFT, 0);
|
2009-07-10 13:56:29 +00:00
|
|
|
RNA_boolean_set(WM_keymap_add_item(keymap, "OBJECT_OT_duplicate", DKEY, KM_PRESS, KM_ALT, 0)->ptr, "linked", 1);
|
2009-07-13 00:40:20 +00:00
|
|
|
WM_keymap_add_item(keymap, "OBJECT_OT_join", JKEY, KM_PRESS, KM_CTRL, 0);
|
2009-09-22 04:40:16 +00:00
|
|
|
WM_keymap_add_item(keymap, "OBJECT_OT_convert", CKEY, KM_PRESS, KM_ALT, 0);
|
2009-07-28 03:54:40 +00:00
|
|
|
WM_keymap_add_item(keymap, "OBJECT_OT_proxy_make", PKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
|
2009-01-15 16:07:39 +00:00
|
|
|
|
2.5: Blender "Animato" - New Animation System
Finally, here is the basic (functional) prototype of the new animation system which will allow for the infamous "everything is animatable", and which also addresses several of the more serious shortcomings of the old system. Unfortunately, this will break old animation files (especially right now, as I haven't written the version patching code yet), however, this is for the future.
Highlights of the new system:
* Scrapped IPO-Curves/IPO/(Action+Constraint-Channels)/Action system, and replaced it with F-Curve/Action.
- F-Curves (animators from other packages will feel at home with this name) replace IPO-Curves.
- The 'new' Actions, act as the containers for F-Curves, so that they can be reused. They are therefore more akin to the old 'IPO' blocks, except they do not have the blocktype restriction, so you can store materials/texture/geometry F-Curves in the same Action as Object transforms, etc.
* F-Curves use RNA-paths for Data Access, hence allowing "every" (where sensible/editable that is) user-accessible setting from RNA to be animated.
* Drivers are no longer mixed with Animation Data, so rigs will not be that easily broken and several dependency problems can be eliminated. (NOTE: drivers haven't been hooked up yet, but the code is in place)
* F-Curve modifier system allows useful 'large-scale' manipulation of F-Curve values, including (I've only included implemented ones here): envelope deform (similar to lattices to allow broad-scale reshaping of curves), curve generator (polynomial or py-expression), cycles (replacing the old cyclic extrapolation modes, giving more control over this). (NOTE: currently this cannot be tested, as there's not access to them, but the code is all in place)
* NLA system with 'tracks' (i.e. layers), and multiple strips per track. (NOTE: NLA system is not yet functional, as it's only partially coded still)
There are more nice things that I will be preparing some nice docs for soon, but for now, check for more details:
http://lists.blender.org/pipermail/bf-taskforce25/2009-January/000260.html
So, what currently works:
* I've implemented two basic operators for the 3D-view only to Insert and Delete Keyframes. These are tempolary ones only that will be replaced in due course with 'proper' code.
* Object Loc/Rot/Scale can be keyframed. Also, the colour of the 'active' material (Note: this should really be for nth material instead, but that doesn't work yet in RNA) can also be keyframed into the same datablock.
* Standard animation refresh (i.e. animation resulting from NLA and Action evaluation) is now done completely separate from drivers before anything else is done after a frame change. Drivers are handled after this in a separate pass, as dictated by depsgraph flags, etc.
Notes:
* Drivers haven't been hooked up yet
* Only objects and data directly linked to objects can be animated.
* Depsgraph will need further tweaks. Currently, I've only made sure that it will update some things in the most basic cases (i.e. frame change).
* Animation Editors are currently broken (in terms of editing stuff). This will be my next target (priority to get Dopesheet working first, then F-Curve editor - i.e. old IPO Editor)
* I've had to put in large chunks of XXX sandboxing for old animation system code all around the place. This will be cleaned up in due course, as some places need special review.
In particular, the particles and sequencer code have far too many manual calls to calculate + flush animation info, which is really bad (this is a 'please explain yourselves' call to Physics coders!).
2009-01-17 03:12:50 +00:00
|
|
|
// XXX this should probably be in screen instead... here for testing purposes in the meantime... - Aligorith
|
2009-03-31 22:36:13 +00:00
|
|
|
WM_keymap_verify_item(keymap, "ANIM_OT_insert_keyframe_menu", IKEY, KM_PRESS, 0, 0);
|
2009-07-24 08:05:56 +00:00
|
|
|
WM_keymap_verify_item(keymap, "ANIM_OT_delete_keyframe_v3d", IKEY, KM_PRESS, KM_ALT, 0);
|
2009-01-20 03:41:23 +00:00
|
|
|
|
|
|
|
WM_keymap_verify_item(keymap, "GROUP_OT_group_create", GKEY, KM_PRESS, KM_CTRL, 0);
|
2009-03-29 02:15:13 +00:00
|
|
|
WM_keymap_verify_item(keymap, "GROUP_OT_objects_remove", GKEY, KM_PRESS, KM_CTRL|KM_ALT, 0);
|
2009-01-20 10:50:36 +00:00
|
|
|
WM_keymap_verify_item(keymap, "GROUP_OT_objects_add_active", GKEY, KM_PRESS, KM_SHIFT|KM_CTRL, 0);
|
|
|
|
WM_keymap_verify_item(keymap, "GROUP_OT_objects_remove_active", GKEY, KM_PRESS, KM_SHIFT|KM_ALT, 0);
|
|
|
|
|
2009-07-03 15:23:33 +00:00
|
|
|
/* Lattice */
|
2009-09-17 21:36:02 +00:00
|
|
|
keymap= WM_keymap_find(wm, "Lattice", 0, 0);
|
|
|
|
keymap->poll= ED_operator_editlattice;
|
2009-07-03 15:23:33 +00:00
|
|
|
|
|
|
|
WM_keymap_add_item(keymap, "LATTICE_OT_select_all_toggle", AKEY, KM_PRESS, 0, 0);
|
2008-12-23 19:47:33 +00:00
|
|
|
}
|
|
|
|
|