diff options
author | Campbell Barton <ideasman42@gmail.com> | 2021-12-08 16:55:11 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2021-12-08 17:14:10 +0300 |
commit | 61776befc3f88c373e47ccbdf8c75e2ca0f4e987 (patch) | |
tree | 0214b7c5146300d41b7bcbe99f87c92599608e7f /source/blender/editors/transform | |
parent | 8f1997975dc60bc1c18992458603ecd58dfded6d (diff) |
Cleanup: move public doc-strings into headers for 'editors'
Ref T92709
Diffstat (limited to 'source/blender/editors/transform')
28 files changed, 196 insertions, 194 deletions
diff --git a/source/blender/editors/transform/transform.c b/source/blender/editors/transform/transform.c index ae4c3f02c46..386fd85213e 100644 --- a/source/blender/editors/transform/transform.c +++ b/source/blender/editors/transform/transform.c @@ -668,7 +668,6 @@ static bool transform_modal_item_poll(const wmOperator *op, int value) return true; } -/* Called in transform_ops.c, on each regeneration of key-maps. */ wmKeyMap *transform_modal_keymap(wmKeyConfig *keyconf) { static const EnumPropertyItem modal_items[] = { @@ -1449,9 +1448,6 @@ static void drawTransformPixel(const struct bContext *C, ARegion *region, void * } } -/** - * \see #initTransform which reads values from the operator. - */ void saveTransform(bContext *C, TransInfo *t, wmOperator *op) { ToolSettings *ts = CTX_data_tool_settings(C); @@ -1670,11 +1666,6 @@ static void initSnapSpatial(TransInfo *t, float r_snap[2]) } } -/** - * \note caller needs to free 't' on a 0 return - * \warning \a event might be NULL (when tweaking from redo panel) - * \see #saveTransform which writes these values back. - */ bool initTransform(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *event, int mode) { int options = 0; @@ -1987,7 +1978,6 @@ int transformEnd(bContext *C, TransInfo *t) return exit_code; } -/* TODO: move to: `transform_query.c`. */ bool checkUseAxisMatrix(TransInfo *t) { /* currently only checks for editmode */ diff --git a/source/blender/editors/transform/transform.h b/source/blender/editors/transform/transform.h index 380df739876..3a8155ce9f7 100644 --- a/source/blender/editors/transform/transform.h +++ b/source/blender/editors/transform/transform.h @@ -687,11 +687,19 @@ typedef struct TransInfo { /** \name Public Transform API * \{ */ +/** + * \note caller needs to free `t` on a 0 return + * \warning \a event might be NULL (when tweaking from redo panel) + * \see #saveTransform which writes these values back. + */ bool initTransform(struct bContext *C, struct TransInfo *t, struct wmOperator *op, const struct wmEvent *event, int mode); +/** + * \see #initTransform which reads values from the operator. + */ void saveTransform(struct bContext *C, struct TransInfo *t, struct wmOperator *op); int transformEvent(TransInfo *t, const struct wmEvent *event); void transformApply(struct bContext *C, TransInfo *t); @@ -708,6 +716,9 @@ void projectFloatView(TransInfo *t, const float vec[3], float adr[2]); void applyAspectRatio(TransInfo *t, float vec[2]); void removeAspectRatio(TransInfo *t, float vec[2]); +/** + * Called in transform_ops.c, on each regeneration of key-maps. + */ struct wmKeyMap *transform_modal_keymap(struct wmKeyConfig *keyconf); /** \} */ @@ -772,12 +783,28 @@ void setInputPostFct(MouseInput *mi, void (*post)(struct TransInfo *t, float val /** \name Generics * \{ */ +/** + * Setup internal data, mouse, vectors + * + * \note \a op and \a event can be NULL + * + * \see #saveTransform does the reverse. + */ void initTransInfo(struct bContext *C, TransInfo *t, struct wmOperator *op, const struct wmEvent *event); +/** + * Needed for mode switching. + */ void freeTransCustomDataForMode(TransInfo *t); +/** + * Here I would suggest only #TransInfo related issues, like free data & reset vars. Not redraws. + */ void postTrans(struct bContext *C, TransInfo *t); +/** + * Free data before switching to another mode. + */ void resetTransModal(TransInfo *t); void resetTransRestrictions(TransInfo *t); @@ -800,17 +827,25 @@ void calculateCenterMedian(TransInfo *t, float r_center[3]); void calculateCenterCursor(TransInfo *t, float r_center[3]); void calculateCenterCursor2D(TransInfo *t, float r_center[2]); void calculateCenterCursorGraph2D(TransInfo *t, float r_center[2]); +/** + * \param select_only: only get active center from data being transformed. + */ bool calculateCenterActive(TransInfo *t, bool select_only, float r_center[3]); void calculatePropRatio(TransInfo *t); +/** + * Rotate an element, low level code, ignore protected channels. + * (use for objects or pose-bones) + * Similar to #ElementRotation. + */ void transform_data_ext_rotate(TransData *td, float mat[3][3], bool use_drot); struct Object *transform_object_deform_pose_armature_get(const TransInfo *t, struct Object *ob); void freeCustomNormalArray(TransInfo *t, TransDataContainer *tc, TransCustomData *custom_data); -/* TODO: `transform_query.c`. */ +/* TODO: move to: `transform_query.c`. */ bool checkUseAxisMatrix(TransInfo *t); #define TRANSFORM_SNAP_MAX_PX 100.0f diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c index a24491119c6..ede4c3e458c 100644 --- a/source/blender/editors/transform/transform_constraints.c +++ b/source/blender/editors/transform/transform_constraints.c @@ -295,10 +295,6 @@ static void constraint_snap_plane_to_edge(const TransInfo *t, const float plane[ } } -/** - * Snap to the nearest point between the snap point and the line that - * intersects the face plane with the constraint plane. - */ static void UNUSED_FUNCTION(constraint_snap_plane_to_face(const TransInfo *t, const float plane[4], float r_out[3])) @@ -314,9 +310,6 @@ static void UNUSED_FUNCTION(constraint_snap_plane_to_face(const TransInfo *t, } } -/** - * Snap to the nearest point on the axis to the edge/line element. - */ void transform_constraint_snap_axis_to_edge(const TransInfo *t, const float axis[3], float r_out[3]) @@ -331,9 +324,6 @@ void transform_constraint_snap_axis_to_edge(const TransInfo *t, } } -/** - * Snap to the intersection of the axis and the plane defined by the face. - */ void transform_constraint_snap_axis_to_face(const TransInfo *t, const float axis[3], float r_out[3]) @@ -700,7 +690,6 @@ void setConstraint(TransInfo *t, int mode, const char text[]) t->redraw = TREDRAW_HARD; } -/* applies individual td->axismtx constraints */ void setAxisMatrixConstraint(TransInfo *t, int mode, const char text[]) { BLI_strncpy(t->con.text + 1, text, sizeof(t->con.text) - 1); @@ -728,12 +717,6 @@ void setLocalConstraint(TransInfo *t, int mode, const char text[]) } } -/** - * Set the constraint according to the user defined orientation - * - * `ftext` is a format string passed to #BLI_snprintf. It will add the name of - * the orientation where %s is (logically). - */ void setUserConstraint(TransInfo *t, int mode, const char ftext[]) { char text[256]; @@ -842,7 +825,6 @@ void drawConstraint(TransInfo *t) } } -/* called from drawview.c, as an extra per-window draw option */ void drawPropCircle(const struct bContext *C, TransInfo *t) { if (t->flag & T_PROP_EDIT) { @@ -1200,13 +1182,6 @@ bool isLockConstraint(const TransInfo *t) return false; } -/** - * Returns the dimension of the constraint space. - * - * For that reason, the flags always needs to be set to properly evaluate here, - * even if they aren't actually used in the callback function. - * (Which could happen for weird constraints not yet designed. Along a path for example.) - */ int getConstraintSpaceDimension(const TransInfo *t) { int n = 0; diff --git a/source/blender/editors/transform/transform_constraints.h b/source/blender/editors/transform/transform_constraints.h index 3632b352476..12151f9df07 100644 --- a/source/blender/editors/transform/transform_constraints.h +++ b/source/blender/editors/transform/transform_constraints.h @@ -26,17 +26,35 @@ struct TransInfo; void constraintNumInput(TransInfo *t, float vec[3]); +/** + * Snap to the nearest point on the axis to the edge/line element. + */ void transform_constraint_snap_axis_to_edge(const TransInfo *t, const float axis[3], float r_out[3]); +/** + * Snap to the intersection of the axis and the plane defined by the face. + */ void transform_constraint_snap_axis_to_face(const TransInfo *t, const float axis[3], float r_out[3]); void setConstraint(TransInfo *t, int mode, const char text[]); +/** + * Applies individual `td->axismtx` constraints. + */ void setAxisMatrixConstraint(TransInfo *t, int mode, const char text[]); void setLocalConstraint(TransInfo *t, int mode, const char text[]); +/** + * Set the constraint according to the user defined orientation + * + * `ftext` is a format string passed to #BLI_snprintf. It will add the name of + * the orientation where %s is (logically). + */ void setUserConstraint(TransInfo *t, int mode, const char text[]); void drawConstraint(TransInfo *t); +/** + * Called from drawview.c, as an extra per-window draw option. + */ void drawPropCircle(const struct bContext *C, TransInfo *t); void startConstraint(TransInfo *t); void stopConstraint(TransInfo *t); @@ -47,4 +65,11 @@ void setNearestAxis(TransInfo *t); int constraintModeToIndex(const TransInfo *t); char constraintModeToChar(const TransInfo *t); bool isLockConstraint(const TransInfo *t); +/** + * Returns the dimension of the constraint space. + * + * For that reason, the flags always needs to be set to properly evaluate here, + * even if they aren't actually used in the callback function. + * (Which could happen for weird constraints not yet designed. Along a path for example.) + */ int getConstraintSpaceDimension(const TransInfo *t); diff --git a/source/blender/editors/transform/transform_convert.c b/source/blender/editors/transform/transform_convert.c index ff20f569a71..8f3d13176a3 100644 --- a/source/blender/editors/transform/transform_convert.c +++ b/source/blender/editors/transform/transform_convert.c @@ -68,10 +68,6 @@ bool transform_mode_use_local_origins(const TransInfo *t) return ELEM(t->mode, TFM_ROTATION, TFM_RESIZE, TFM_TRACKBALL); } -/** - * Transforming around ourselves is no use, fallback to individual origins, - * useful for curve/armatures. - */ void transform_around_single_fallback_ex(TransInfo *t, int data_len_all) { if (data_len_all != 1) { @@ -369,7 +365,6 @@ static bool pchan_autoik_adjust(bPoseChannel *pchan, short chainlen) return changed; } -/* change the chain-length of auto-ik */ void transform_autoik_update(TransInfo *t, short mode) { Main *bmain = CTX_data_main(t->context); @@ -482,7 +477,6 @@ void calc_distanceCurveVerts(TransData *head, TransData *tail, bool cyclic) BLI_LINKSTACK_FREE(queue); } -/* Utility function for getting the handle data from bezier's */ TransDataCurveHandleFlags *initTransDataCurveHandles(TransData *td, struct BezTriple *bezt) { TransDataCurveHandleFlags *hdata; @@ -611,9 +605,6 @@ void clipUVData(TransInfo *t) /** \name Animation Editors (General) * \{ */ -/** - * Used for `TFM_TIME_EXTEND`. - */ char transform_convert_frame_side_dir_get(TransInfo *t, float cframe) { char r_dir; @@ -636,7 +627,6 @@ char transform_convert_frame_side_dir_get(TransInfo *t, float cframe) return r_dir; } -/* This function tests if a point is on the "mouse" side of the cursor/frame-marking */ bool FrameOnMouseSide(char side, float frame, float cframe) { /* both sides, so it doesn't matter */ @@ -667,14 +657,6 @@ typedef struct tRetainedKeyframe { size_t del_count; /* number of keyframes of this sort that have been deleted so far */ } tRetainedKeyframe; -/** - * Called during special_aftertrans_update to make sure selected keyframes replace - * any other keyframes which may reside on that frame (that is not selected). - * - * \param sel_flag: The flag (bezt.f1/2/3) value to use to determine selection. Usually `SELECT`, - * but may want to use a different one at times (if caller does not operate on - * selection). - */ void posttrans_fcurve_clean(FCurve *fcu, const int sel_flag, const bool use_handle) { /* NOTE: We assume that all keys are sorted */ @@ -798,12 +780,6 @@ void posttrans_fcurve_clean(FCurve *fcu, const int sel_flag, const bool use_hand /** \name Transform Utilities * \{ */ -/* Little helper function for ObjectToTransData used to give certain - * constraints (ChildOf, FollowPath, and others that may be added) - * inverse corrections for transform, so that they aren't in CrazySpace. - * These particular constraints benefit from this, but others don't, hence - * this semi-hack ;-) - Aligorith - */ bool constraints_list_needinv(TransInfo *t, ListBase *list) { bConstraint *con; @@ -894,14 +870,12 @@ bool constraints_list_needinv(TransInfo *t, ListBase *list) /** \name Transform (After-Transform Update) * \{ */ -/* inserting keys, pointcache, redraw events... */ -/** - * \note Sequencer freeing has its own function now because of a conflict - * with transform's order of freeing (campbell). - * Order changed, the sequencer stuff should go back in here - */ void special_aftertrans_update(bContext *C, TransInfo *t) { + /* NOTE: Sequencer freeing has its own function now because of a conflict + * with transform's order of freeing (campbell). + * Order changed, the sequencer stuff should go back in here. */ + /* early out when nothing happened */ if (t->data_len_all == 0 || t->mode == TFM_DUMMY) { return; @@ -1609,7 +1583,6 @@ void transform_convert_clip_mirror_modifier_apply(TransDataContainer *tc) } } -/* for the realtime animation recording feature, handle overlapping data */ void animrecord_check_state(TransInfo *t, struct Object *ob) { Scene *scene = t->scene; @@ -1708,7 +1681,6 @@ void transform_convert_flush_handle2D(TransData *td, TransData2D *td2d, const fl } } -/* called for updating while transform acts, once per redraw */ void recalcData(TransInfo *t) { switch (t->data_type) { diff --git a/source/blender/editors/transform/transform_convert.h b/source/blender/editors/transform/transform_convert.h index e4f2ab05bec..5ed8182857d 100644 --- a/source/blender/editors/transform/transform_convert.h +++ b/source/blender/editors/transform/transform_convert.h @@ -36,47 +36,101 @@ struct TransInfo; struct bContext; /* transform_convert.c */ + +/** + * Change the chain-length of auto-IK. + */ void transform_autoik_update(TransInfo *t, short mode); int special_transform_moving(TransInfo *t); +/** + * Inserting keys, point-cache, redraw events. + */ void special_aftertrans_update(struct bContext *C, TransInfo *t); void sort_trans_data_dist(TransInfo *t); void createTransData(struct bContext *C, TransInfo *t); bool clipUVTransform(TransInfo *t, float vec[2], const bool resize); void clipUVData(TransInfo *t); void transform_convert_flush_handle2D(TransData *td, TransData2D *td2d, const float y_fac); +/** + * Called for updating while transform acts, once per redraw. + */ void recalcData(TransInfo *t); /* transform_convert_mesh.c */ + void transform_convert_mesh_customdatacorrect_init(TransInfo *t); /* transform_convert_sequencer.c */ + void transform_convert_sequencer_channel_clamp(TransInfo *t, float r_val[2]); /********************* intern **********************/ /* transform_convert.c */ + bool transform_mode_use_local_origins(const TransInfo *t); +/** + * Transforming around ourselves is no use, fallback to individual origins, + * useful for curve/armatures. + */ void transform_around_single_fallback_ex(TransInfo *t, int data_len_all); void transform_around_single_fallback(TransInfo *t); +/** + * Called during special_aftertrans_update to make sure selected keyframes replace + * any other keyframes which may reside on that frame (that is not selected). + * + * \param sel_flag: The flag (bezt.f1/2/3) value to use to determine selection. Usually `SELECT`, + * but may want to use a different one at times (if caller does not operate on + * selection). + */ void posttrans_fcurve_clean(struct FCurve *fcu, const int sel_flag, const bool use_handle); +/** + * Little helper function for ObjectToTransData used to give certain + * constraints (ChildOf, FollowPath, and others that may be added) + * inverse corrections for transform, so that they aren't in CrazySpace. + * These particular constraints benefit from this, but others don't, hence + * this semi-hack ;-) - Aligorith + */ bool constraints_list_needinv(TransInfo *t, ListBase *list); void calc_distanceCurveVerts(TransData *head, TransData *tail, bool cyclic); +/** + * Utility function for getting the handle data from bezier's. + */ struct TransDataCurveHandleFlags *initTransDataCurveHandles(TransData *td, struct BezTriple *bezt); +/** + * Used for `TFM_TIME_EXTEND`. + */ char transform_convert_frame_side_dir_get(TransInfo *t, float cframe); +/** + * This function tests if a point is on the "mouse" side of the cursor/frame-marking. + */ bool FrameOnMouseSide(char side, float frame, float cframe); void transform_convert_clip_mirror_modifier_apply(TransDataContainer *tc); +/** + * For the realtime animation recording feature, handle overlapping data. + */ void animrecord_check_state(TransInfo *t, struct Object *ob); /* transform_convert_action.c */ + void createTransActionData(bContext *C, TransInfo *t); +/* helper for recalcData() - for Action Editor transforms */ void recalcData_actedit(TransInfo *t); void special_aftertrans_update__actedit(bContext *C, TransInfo *t); /* transform_convert_armature.c */ + +/** + * Sets transform flags in the bones. + * Returns total number of bones with #BONE_TRANSFORM. + */ int transform_convert_pose_transflags_update(Object *ob, const int mode, const short around, bool has_translate_rotate[2]); +/** + * When objects array is NULL, use 't->data_container' as is. + */ void createTransPose(TransInfo *t); void createTransArmatureVerts(TransInfo *t); void recalcData_edit_armature(TransInfo *t); @@ -84,6 +138,7 @@ void recalcData_pose(TransInfo *t); void special_aftertrans_update__pose(bContext *C, TransInfo *t); /* transform_convert_cursor.c */ + void createTransCursor_image(TransInfo *t); void createTransCursor_sequencer(TransInfo *t); void createTransCursor_view3d(TransInfo *t); @@ -92,16 +147,28 @@ void recalcData_cursor_sequencer(TransInfo *t); void recalcData_cursor_view3d(TransInfo *t); /* transform_convert_curve.c */ + void createTransCurveVerts(TransInfo *t); void recalcData_curve(TransInfo *t); /* transform_convert_graph.c */ +/** + * It is important to note that this doesn't always act on the selection (like it's usually done), + * it acts on a subset of it. E.g. the selection code may leave a hint that we just dragged on a + * left or right handle (SIPO_RUNTIME_FLAG_TWEAK_HANDLES_LEFT/RIGHT) and then we only transform the + * selected left or right handles accordingly. + * The points to be transformed are tagged with BEZT_FLAG_TEMP_TAG; some lower level curve + * functions may need to be made aware of this. It's ugly that these act based on selection state + * anyway. + */ void createTransGraphEditData(bContext *C, TransInfo *t); +/* helper for recalcData() - for Graph Editor transforms */ void recalcData_graphedit(TransInfo *t); void special_aftertrans_update__graph(bContext *C, TransInfo *t); /* transform_convert_gpencil.c */ void createTransGPencil(bContext *C, TransInfo *t); +/* force recalculation of triangles during transformation */ void recalcData_gpencil_strokes(TransInfo *t); /* transform_convert_lattice.c */ @@ -146,6 +213,11 @@ void transform_convert_mesh_islands_calc(struct BMEditMesh *em, const bool calc_island_axismtx, struct TransIslandData *r_island_data); void transform_convert_mesh_islanddata_free(struct TransIslandData *island_data); +/** + * \param mtx: Measure distance in this space. + * \param dists: Store the closest connected distance to selected vertices. + * \param index: Optionally store the original index we're measuring the distance to (can be NULL). + */ void transform_convert_mesh_connectivity_distance(struct BMesh *bm, const float mtx[3][3], float *dists, @@ -156,6 +228,10 @@ void transform_convert_mesh_mirrordata_calc(struct BMEditMesh *em, const bool mirror_axis[3], struct TransMirrorData *r_mirror_data); void transform_convert_mesh_mirrordata_free(struct TransMirrorData *mirror_data); +/** + * Detect CrazySpace [tm]. + * Vertices with space affected by quats are marked with #BM_ELEM_TAG. + */ void transform_convert_mesh_crazyspace_detect(TransInfo *t, struct TransDataContainer *tc, struct BMEditMesh *em, @@ -181,10 +257,12 @@ void recalcData_mesh_skin(TransInfo *t); /* transform_convert_mesh_uv.c */ void createTransUVs(bContext *C, TransInfo *t); +/* helper for recalcData() - for Image Editor transforms */ void recalcData_uv(TransInfo *t); /* transform_convert_nla.c */ void createTransNlaData(bContext *C, TransInfo *t); +/* helper for recalcData() - for NLA Editor transforms */ void recalcData_nla(TransInfo *t); void special_aftertrans_update__nla(bContext *C, TransInfo *t); @@ -195,11 +273,13 @@ void special_aftertrans_update__node(bContext *C, TransInfo *t); /* transform_convert_object.c */ void createTransObject(bContext *C, TransInfo *t); +/* helper for recalcData() - for object transforms, typically in the 3D view */ void recalcData_objects(TransInfo *t); void special_aftertrans_update__object(bContext *C, TransInfo *t); /* transform_convert_object_texspace.c */ void createTransTexspace(TransInfo *t); +/* helper for recalcData() - for object transforms, typically in the 3D view */ void recalcData_texspace(TransInfo *t); /* transform_convert_paintcurve.c */ @@ -217,6 +297,7 @@ void special_aftertrans_update__sculpt(bContext *C, TransInfo *t); /* transform_convert_sequencer.c */ void createTransSeqData(TransInfo *t); +/* helper for recalcData() - for sequencer transforms */ void recalcData_sequencer(TransInfo *t); void special_aftertrans_update__sequencer(bContext *C, TransInfo *t); @@ -226,5 +307,6 @@ void recalcData_sequencer_image(TransInfo *t); /* transform_convert_tracking.c */ void createTransTrackingData(bContext *C, TransInfo *t); +/* helper for recalcData() - for Movie Clip transforms */ void recalcData_tracking(TransInfo *t); void special_aftertrans_update__movieclip(bContext *C, TransInfo *t); diff --git a/source/blender/editors/transform/transform_convert_action.c b/source/blender/editors/transform/transform_convert_action.c index 24d84bc2de8..69b4de48c56 100644 --- a/source/blender/editors/transform/transform_convert_action.c +++ b/source/blender/editors/transform/transform_convert_action.c @@ -580,7 +580,6 @@ static void flushTransIntFrameActionData(TransInfo *t) } } -/* helper for recalcData() - for Action Editor transforms */ void recalcData_actedit(TransInfo *t) { ViewLayer *view_layer = t->view_layer; diff --git a/source/blender/editors/transform/transform_convert_armature.c b/source/blender/editors/transform/transform_convert_armature.c index 88790e9645c..63aada0f797 100644 --- a/source/blender/editors/transform/transform_convert_armature.c +++ b/source/blender/editors/transform/transform_convert_armature.c @@ -716,9 +716,6 @@ static void add_pose_transdata(TransInfo *t, bPoseChannel *pchan, Object *ob, Tr td->con = pchan->constraints.first; } -/** - * When objects array is NULL, use 't->data_container' as is. - */ void createTransPose(TransInfo *t) { Main *bmain = CTX_data_main(t->context); @@ -1502,10 +1499,6 @@ static void bone_children_clear_transflag(int mode, short around, ListBase *lb) } } -/** - * Sets transform flags in the bones. - * Returns total number of bones with #BONE_TRANSFORM. - */ int transform_convert_pose_transflags_update(Object *ob, const int mode, const short around, diff --git a/source/blender/editors/transform/transform_convert_gpencil.c b/source/blender/editors/transform/transform_convert_gpencil.c index f7b78b10868..9c8671c80f3 100644 --- a/source/blender/editors/transform/transform_convert_gpencil.c +++ b/source/blender/editors/transform/transform_convert_gpencil.c @@ -748,7 +748,6 @@ void createTransGPencil(bContext *C, TransInfo *t) } } -/* force recalculation of triangles during transformation */ void recalcData_gpencil_strokes(TransInfo *t) { TransDataContainer *tc = TRANS_DATA_CONTAINER_FIRST_SINGLE(t); diff --git a/source/blender/editors/transform/transform_convert_graph.c b/source/blender/editors/transform/transform_convert_graph.c index d22277f9d91..40c226b8f7c 100644 --- a/source/blender/editors/transform/transform_convert_graph.c +++ b/source/blender/editors/transform/transform_convert_graph.c @@ -218,15 +218,6 @@ static void graph_key_shortest_dist( } } -/** - * It is important to note that this doesn't always act on the selection (like it's usually done), - * it acts on a subset of it. E.g. the selection code may leave a hint that we just dragged on a - * left or right handle (SIPO_RUNTIME_FLAG_TWEAK_HANDLES_LEFT/RIGHT) and then we only transform the - * selected left or right handles accordingly. - * The points to be transformed are tagged with BEZT_FLAG_TEMP_TAG; some lower level curve - * functions may need to be made aware of this. It's ugly that these act based on selection state - * anyway. - */ void createTransGraphEditData(bContext *C, TransInfo *t) { SpaceGraph *sipo = (SpaceGraph *)t->area->spacedata.first; @@ -913,7 +904,6 @@ static void remake_graph_transdata(TransInfo *t, ListBase *anim_data) } } -/* helper for recalcData() - for Graph Editor transforms */ void recalcData_graphedit(TransInfo *t) { SpaceGraph *sipo = (SpaceGraph *)t->area->spacedata.first; diff --git a/source/blender/editors/transform/transform_convert_mesh.c b/source/blender/editors/transform/transform_convert_mesh.c index 7377e47da3d..cd3d4fb0659 100644 --- a/source/blender/editors/transform/transform_convert_mesh.c +++ b/source/blender/editors/transform/transform_convert_mesh.c @@ -1000,11 +1000,6 @@ static bool bmesh_test_loose_edge(BMEdge *edge) return true; } -/** - * \param mtx: Measure distance in this space. - * \param dists: Store the closest connected distance to selected vertices. - * \param index: Optionally store the original index we're measuring the distance to (can be NULL). - */ void transform_convert_mesh_connectivity_distance(struct BMesh *bm, const float mtx[3][3], float *dists, @@ -1307,8 +1302,6 @@ void transform_convert_mesh_mirrordata_free(struct TransMirrorData *mirror_data) /** \name Crazy Space * \{ */ -/* Detect CrazySpace [tm]. - * Vertices with space affected by quats are marked with #BM_ELEM_TAG */ void transform_convert_mesh_crazyspace_detect(TransInfo *t, struct TransDataContainer *tc, struct BMEditMesh *em, diff --git a/source/blender/editors/transform/transform_convert_mesh_uv.c b/source/blender/editors/transform/transform_convert_mesh_uv.c index 61397b6ef4b..69f29389b31 100644 --- a/source/blender/editors/transform/transform_convert_mesh_uv.c +++ b/source/blender/editors/transform/transform_convert_mesh_uv.c @@ -464,7 +464,6 @@ static void flushTransUVs(TransInfo *t) } } -/* helper for recalcData() - for Image Editor transforms */ void recalcData_uv(TransInfo *t) { SpaceImage *sima = t->area->spacedata.first; diff --git a/source/blender/editors/transform/transform_convert_nla.c b/source/blender/editors/transform/transform_convert_nla.c index acef8a666e3..d19698a4f61 100644 --- a/source/blender/editors/transform/transform_convert_nla.c +++ b/source/blender/editors/transform/transform_convert_nla.c @@ -266,7 +266,6 @@ void createTransNlaData(bContext *C, TransInfo *t) ANIM_animdata_freelist(&anim_data); } -/* helper for recalcData() - for NLA Editor transforms */ void recalcData_nla(TransInfo *t) { SpaceNla *snla = (SpaceNla *)t->area->spacedata.first; diff --git a/source/blender/editors/transform/transform_convert_object.c b/source/blender/editors/transform/transform_convert_object.c index 4a8ebf3fc6e..52365e4e519 100644 --- a/source/blender/editors/transform/transform_convert_object.c +++ b/source/blender/editors/transform/transform_convert_object.c @@ -874,7 +874,6 @@ static bool motionpath_need_update_object(Scene *scene, Object *ob) /** \name Recalc Data object * \{ */ -/* helper for recalcData() - for object transforms, typically in the 3D view */ void recalcData_objects(TransInfo *t) { bool motionpath_update = false; diff --git a/source/blender/editors/transform/transform_convert_object_texspace.c b/source/blender/editors/transform/transform_convert_object_texspace.c index 371a5b48818..98879852326 100644 --- a/source/blender/editors/transform/transform_convert_object_texspace.c +++ b/source/blender/editors/transform/transform_convert_object_texspace.c @@ -102,7 +102,6 @@ void createTransTexspace(TransInfo *t) /** \name Recalc Data object * \{ */ -/* helper for recalcData() - for object transforms, typically in the 3D view */ void recalcData_texspace(TransInfo *t) { diff --git a/source/blender/editors/transform/transform_convert_sequencer.c b/source/blender/editors/transform/transform_convert_sequencer.c index 70089164d8a..88c01321785 100644 --- a/source/blender/editors/transform/transform_convert_sequencer.c +++ b/source/blender/editors/transform/transform_convert_sequencer.c @@ -789,7 +789,6 @@ static void flushTransSeq(TransInfo *t) SEQ_collection_free(transformed_strips); } -/* helper for recalcData() - for sequencer transforms */ void recalcData_sequencer(TransInfo *t) { TransData *td; diff --git a/source/blender/editors/transform/transform_convert_tracking.c b/source/blender/editors/transform/transform_convert_tracking.c index 211dec3c4e8..dc37f2796bf 100644 --- a/source/blender/editors/transform/transform_convert_tracking.c +++ b/source/blender/editors/transform/transform_convert_tracking.c @@ -707,7 +707,6 @@ static void flushTransTracking(TransInfo *t) } } -/* helper for recalcData() - for Movie Clip transforms */ void recalcData_tracking(TransInfo *t) { SpaceClip *sc = t->area->spacedata.first; diff --git a/source/blender/editors/transform/transform_draw_cursors.c b/source/blender/editors/transform/transform_draw_cursors.c index af1f3cb72a4..13127ae06bb 100644 --- a/source/blender/editors/transform/transform_draw_cursors.c +++ b/source/blender/editors/transform/transform_draw_cursors.c @@ -88,20 +88,12 @@ static void drawArrow(const uint pos_id, const enum eArrowDirection dir) immEnd(); } -/** - * Poll callback for cursor drawing: - * #WM_paint_cursor_activate - */ bool transform_draw_cursor_poll(bContext *C) { ARegion *region = CTX_wm_region(C); return (region && ELEM(region->regiontype, RGN_TYPE_WINDOW, RGN_TYPE_PREVIEW)) ? 1 : 0; } -/** - * Cursor and help-line drawing, callback for: - * #WM_paint_cursor_activate - */ void transform_draw_cursor_draw(bContext *UNUSED(C), int x, int y, void *customdata) { TransInfo *t = (TransInfo *)customdata; diff --git a/source/blender/editors/transform/transform_draw_cursors.h b/source/blender/editors/transform/transform_draw_cursors.h index 0f626c9039b..b520cd1d4f8 100644 --- a/source/blender/editors/transform/transform_draw_cursors.h +++ b/source/blender/editors/transform/transform_draw_cursors.h @@ -24,5 +24,14 @@ #pragma once /* Callbacks for #WM_paint_cursor_activate */ + +/** + * Poll callback for cursor drawing: + * #WM_paint_cursor_activate + */ bool transform_draw_cursor_poll(struct bContext *C); +/** + * Cursor and help-line drawing, callback for: + * #WM_paint_cursor_activate + */ void transform_draw_cursor_draw(struct bContext *C, int x, int y, void *customdata); diff --git a/source/blender/editors/transform/transform_generics.c b/source/blender/editors/transform/transform_generics.c index 84a685c2e72..a842975a76e 100644 --- a/source/blender/editors/transform/transform_generics.c +++ b/source/blender/editors/transform/transform_generics.c @@ -125,9 +125,6 @@ void drawLine(TransInfo *t, const float center[3], const float dir[3], char axis GPU_matrix_pop(); } -/** - * Free data before switching to another mode. - */ void resetTransModal(TransInfo *t) { freeTransCustomDataForMode(t); @@ -191,13 +188,6 @@ static int t_around_get(TransInfo *t) return V3D_AROUND_CENTER_BOUNDS; } -/** - * Setup internal data, mouse, vectors - * - * \note \a op and \a event can be NULL - * - * \see #saveTransform does the reverse. - */ void initTransInfo(bContext *C, TransInfo *t, wmOperator *op, const wmEvent *event) { Scene *sce = CTX_data_scene(C); @@ -719,9 +709,6 @@ static void freeTransCustomDataContainer(TransInfo *t, } } -/** - * Needed for mode switching. - */ void freeTransCustomDataForMode(TransInfo *t) { freeTransCustomData(t, NULL, &t->custom.mode); @@ -730,7 +717,6 @@ void freeTransCustomDataForMode(TransInfo *t) } } -/* Here I would suggest only TransInfo related issues, like free data & reset vars. Not redraws */ void postTrans(bContext *C, TransInfo *t) { if (t->draw_handle_view) { @@ -1068,9 +1054,6 @@ void calculateCenterBound(TransInfo *t, float r_center[3]) } } -/** - * \param select_only: only get active center from data being transformed. - */ bool calculateCenterActive(TransInfo *t, bool select_only, float r_center[3]) { TransDataContainer *tc = TRANS_DATA_CONTAINER_FIRST_OK(t); @@ -1324,11 +1307,6 @@ void calculatePropRatio(TransInfo *t) } } -/** - * Rotate an element, low level code, ignore protected channels. - * (use for objects or pose-bones) - * Similar to #ElementRotation. - */ void transform_data_ext_rotate(TransData *td, float mat[3][3], bool use_drot) { float totmat[3][3]; diff --git a/source/blender/editors/transform/transform_gizmo_3d.c b/source/blender/editors/transform/transform_gizmo_3d.c index 6a2353d403f..9bd55d78039 100644 --- a/source/blender/editors/transform/transform_gizmo_3d.c +++ b/source/blender/editors/transform/transform_gizmo_3d.c @@ -623,8 +623,6 @@ bool gimbal_axis_object(Object *ob, float gmat[3][3]) return 1; } -/* centroid, boundbox, of selection */ -/* returns total items selected */ int ED_transform_calc_gizmo_stats(const bContext *C, const struct TransformCalcParams *params, struct TransformBounds *tbounds) @@ -2005,7 +2003,6 @@ void VIEW3D_GGT_xform_gizmo(wmGizmoGroupType *gzgt) ""); } -/** Only poll, flag & gzmap_params differ. */ void VIEW3D_GGT_xform_gizmo_context(wmGizmoGroupType *gzgt) { gzgt->name = "3D View: Transform Gizmo Context"; diff --git a/source/blender/editors/transform/transform_mode.c b/source/blender/editors/transform/transform_mode.c index 0f520c4d3f1..5ecafdeb44e 100644 --- a/source/blender/editors/transform/transform_mode.c +++ b/source/blender/editors/transform/transform_mode.c @@ -78,7 +78,6 @@ bool transdata_check_local_center(const TransInfo *t, short around) (t->options & (CTX_MOVIECLIP | CTX_MASK | CTX_PAINT_CURVE | CTX_SEQUENCER_IMAGE)))); } -/* Informs if the mode can be switched during modal. */ bool transform_mode_is_changeable(const int mode) { return ELEM(mode, @@ -523,7 +522,6 @@ void constraintSizeLim(const TransInfo *t, TransData *td) /* -------------------------------------------------------------------- */ /** \name Transform (Rotation Utils) * \{ */ -/* Used by Transform Rotation and Transform Normal Rotation */ void headerRotation(TransInfo *t, char *str, const int str_size, float final) { size_t ofs = 0; @@ -551,12 +549,6 @@ void headerRotation(TransInfo *t, char *str, const int str_size, float final) } } -/** - * Applies values of rotation to `td->loc` and `td->ext->quat` - * based on a rotation matrix (mat) and a pivot (center). - * - * Protected axis and other transform settings are taken into account. - */ void ElementRotation_ex(const TransInfo *t, const TransDataContainer *tc, TransData *td, @@ -833,6 +825,7 @@ void ElementRotation(const TransInfo *t, /* -------------------------------------------------------------------- */ /** \name Transform (Resize Utils) * \{ */ + void headerResize(TransInfo *t, const float vec[3], char *str, const int str_size) { char tvec[NUM_STR_REP_LEN * 3]; @@ -1232,9 +1225,6 @@ void transform_mode_init(TransInfo *t, wmOperator *op, const int mode) * BLI_assert(t->mode == mode); */ } -/** - * When in modal and not set, initializes a default orientation for the mode. - */ void transform_mode_default_modal_orientation_set(TransInfo *t, int type) { /* Currently only these types are supported. */ diff --git a/source/blender/editors/transform/transform_mode.h b/source/blender/editors/transform/transform_mode.h index c561d1c8a4f..ec3d5b8d0fe 100644 --- a/source/blender/editors/transform/transform_mode.h +++ b/source/blender/editors/transform/transform_mode.h @@ -42,12 +42,24 @@ typedef struct TransDataGenericSlideVert { /* transform_mode.c */ int transform_mode_really_used(struct bContext *C, int mode); bool transdata_check_local_center(const TransInfo *t, short around); +/** + * Informs if the mode can be switched during modal. + */ bool transform_mode_is_changeable(const int mode); void protectedTransBits(short protectflag, float vec[3]); void protectedSizeBits(short protectflag, float size[3]); void constraintTransLim(const TransInfo *t, TransData *td); void constraintSizeLim(const TransInfo *t, TransData *td); +/** + * Used by Transform Rotation and Transform Normal Rotation. + */ void headerRotation(TransInfo *t, char *str, int str_size, float final); +/** + * Applies values of rotation to `td->loc` and `td->ext->quat` + * based on a rotation matrix (mat) and a pivot (center). + * + * Protected axis and other transform settings are taken into account. + */ void ElementRotation_ex(const TransInfo *t, const TransDataContainer *tc, TransData *td, @@ -64,6 +76,9 @@ void ElementResize(const TransInfo *t, TransData *td, const float mat[3][3]); void transform_mode_init(TransInfo *t, struct wmOperator *op, const int mode); +/** + * When in modal and not set, initializes a default orientation for the mode. + */ void transform_mode_default_modal_orientation_set(TransInfo *t, int type); /* transform_mode_align.c */ diff --git a/source/blender/editors/transform/transform_orientations.c b/source/blender/editors/transform/transform_orientations.c index 61bbe722d71..fa2485c33c2 100644 --- a/source/blender/editors/transform/transform_orientations.c +++ b/source/blender/editors/transform/transform_orientations.c @@ -315,11 +315,6 @@ bool createSpaceNormal(float mat[3][3], const float normal[3]) return true; } -/** - * \note To recreate an orientation from the matrix: - * - (plane == mat[1]) - * - (normal == mat[2]) - */ bool createSpaceNormalTangent(float mat[3][3], const float normal[3], const float tangent[3]) { if (normalize_v3_v3(mat[2], normal) == 0.0f) { @@ -503,15 +498,6 @@ void ED_transform_calc_orientation_from_type(const bContext *C, float r_mat[3][3 scene, view_layer, v3d, rv3d, ob, obedit, orient_index, pivot_point, r_mat); } -/** - * \note The resulting matrix may not be orthogonal, - * callers that depend on `r_mat` to be orthogonal should use #orthogonalize_m3. - * - * A non orthogonal matrix may be returned when: - * - #V3D_ORIENT_GIMBAL the result won't be orthogonal unless the object has no rotation. - * - #V3D_ORIENT_LOCAL may contain shear from non-uniform scale in parent/child relationships. - * - #V3D_ORIENT_CUSTOM may have been created from #V3D_ORIENT_LOCAL. - */ short ED_transform_calc_orientation_from_type_ex(const Scene *scene, ViewLayer *view_layer, const View3D *v3d, @@ -602,9 +588,6 @@ short ED_transform_calc_orientation_from_type_ex(const Scene *scene, return orientation_index; } -/* Sets the matrix of the specified space orientation. - * If the matrix cannot be obtained, an orientation different from the one - * informed is returned */ short transform_orientation_matrix_get(bContext *C, TransInfo *t, short orient_index, diff --git a/source/blender/editors/transform/transform_orientations.h b/source/blender/editors/transform/transform_orientations.h index 1da369c8307..6e0e3d9f8c7 100644 --- a/source/blender/editors/transform/transform_orientations.h +++ b/source/blender/editors/transform/transform_orientations.h @@ -25,6 +25,10 @@ struct TransInfo; +/** + * Sets the matrix of the specified space orientation. + * If the matrix cannot be obtained, an orientation different from the one informed is returned. + */ short transform_orientation_matrix_get(struct bContext *C, struct TransInfo *t, short orient_index, @@ -33,12 +37,19 @@ short transform_orientation_matrix_get(struct bContext *C, const char *transform_orientations_spacename_get(struct TransInfo *t, const short orient_type); void transform_orientations_current_set(struct TransInfo *t, const short orient_index); -/* Those two fill in mat and return non-zero on success */ +/** + * Those two fill in mat and return non-zero on success. + */ bool transform_orientations_create_from_axis(float mat[3][3], const float x[3], const float y[3], const float z[3]); bool createSpaceNormal(float mat[3][3], const float normal[3]); +/** + * \note To recreate an orientation from the matrix: + * - (plane == mat[1]) + * - (normal == mat[2]) + */ bool createSpaceNormalTangent(float mat[3][3], const float normal[3], const float tangent[3]); struct TransformOrientation *addMatrixSpace(struct bContext *C, diff --git a/source/blender/editors/transform/transform_snap.h b/source/blender/editors/transform/transform_snap.h index ed7f93304bc..bc89c7a8cda 100644 --- a/source/blender/editors/transform/transform_snap.h +++ b/source/blender/editors/transform/transform_snap.h @@ -76,18 +76,30 @@ void removeSnapPoint(TransInfo *t); float transform_snap_distance_len_squared_fn(TransInfo *t, const float p1[3], const float p2[3]); /* transform_snap_sequencer.c */ + struct TransSeqSnapData *transform_snap_sequencer_data_alloc(const TransInfo *t); void transform_snap_sequencer_data_free(struct TransSeqSnapData *data); bool transform_snap_sequencer_calc(struct TransInfo *t); void transform_snap_sequencer_apply_translate(TransInfo *t, float *vec); /* transform_snap_animation.c */ + +/** + * This function returns the snapping 'mode' for Animation Editors only. + * We cannot use the standard snapping due to NLA-strip scaling complexities. + * + * TODO: these modifier checks should be accessible from the key-map. + */ short getAnimEdit_SnapMode(TransInfo *t); void snapFrameTransform(TransInfo *t, const eAnimEdit_AutoSnap autosnap, const float val_initial, const float val_final, float *r_val_final); +/** + * This function is used by Animation Editor specific transform functions to do + * the Snap Keyframe to Nearest Frame/Marker + */ void transform_snap_anim_flush_data(TransInfo *t, TransData *td, const eAnimEdit_AutoSnap autosnap, diff --git a/source/blender/editors/transform/transform_snap_animation.c b/source/blender/editors/transform/transform_snap_animation.c index 8828f96247d..6ca16c171e2 100644 --- a/source/blender/editors/transform/transform_snap_animation.c +++ b/source/blender/editors/transform/transform_snap_animation.c @@ -38,12 +38,6 @@ /** \name Snapping in Anim Editors * \{ */ -/** - * This function returns the snapping 'mode' for Animation Editors only. - * We cannot use the standard snapping due to NLA-strip scaling complexities. - * - * TODO: these modifier checks should be accessible from the key-map. - */ short getAnimEdit_SnapMode(TransInfo *t) { short autosnap = SACTSNAP_OFF; @@ -128,9 +122,6 @@ void snapFrameTransform(TransInfo *t, } } -/* This function is used by Animation Editor specific transform functions to do - * the Snap Keyframe to Nearest Frame/Marker - */ void transform_snap_anim_flush_data(TransInfo *t, TransData *td, const eAnimEdit_AutoSnap autosnap, diff --git a/source/blender/editors/transform/transform_snap_object.c b/source/blender/editors/transform/transform_snap_object.c index 4b981e763f1..7caa626fe78 100644 --- a/source/blender/editors/transform/transform_snap_object.c +++ b/source/blender/editors/transform/transform_snap_object.c @@ -2865,13 +2865,6 @@ bool ED_transform_snap_object_project_ray_ex(SnapObjectContext *sctx, sctx, ray_start, ray_normal, ray_depth, r_loc, r_no, r_index, r_ob, r_obmat, NULL); } -/** - * Fill in a list of all hits. - * - * \param ray_depth: Only depths in this range are considered, -1.0 for maximum. - * \param sort: Optionally sort the hits by depth. - * \param r_hit_list: List of #SnapObjectHitDepth (caller must free). - */ bool ED_transform_snap_object_project_ray_all(SnapObjectContext *sctx, Depsgraph *depsgraph, const View3D *v3d, @@ -3174,19 +3167,6 @@ short ED_transform_snap_object_project_view3d_ex(SnapObjectContext *sctx, r_face_nor); } -/** - * Convenience function for performing snapping. - * - * Given a 2D region value, snap to vert/edge/face. - * - * \param sctx: Snap context. - * \param mval: Screenspace coordinate. - * \param prev_co: Coordinate for perpendicular point calculation (optional). - * \param dist_px: Maximum distance to snap (in pixels). - * \param r_loc: hit location. - * \param r_no: hit normal (optional). - * \return Snap success - */ short ED_transform_snap_object_project_view3d(SnapObjectContext *sctx, Depsgraph *depsgraph, const ARegion *region, @@ -3216,9 +3196,6 @@ short ED_transform_snap_object_project_view3d(SnapObjectContext *sctx, NULL); } -/** - * see: #ED_transform_snap_object_project_ray_all - */ bool ED_transform_snap_object_project_all_view3d_ex(SnapObjectContext *sctx, Depsgraph *depsgraph, const ARegion *region, |