diff options
| author | Maximilian Albert <maximilian.albert@gmail.com> | 2008-01-11 18:00:46 +0000 |
|---|---|---|
| committer | cilix42 <cilix42@users.sourceforge.net> | 2008-01-11 18:00:46 +0000 |
| commit | e674f2ed46656d100d883cf2cd9f14d25997b685 (patch) | |
| tree | 2b8b8c71f45984cf34b709316ad20c3361d1db5f /src/box3d-context.cpp | |
| parent | Added example file for feTurbulence effect (diff) | |
| download | inkscape-e674f2ed46656d100d883cf2cd9f14d25997b685.tar.gz inkscape-e674f2ed46656d100d883cf2cd9f14d25997b685.zip | |
Check for perspective in document defs (to avoid hanging/crashes after vacuum defs or when opening pre-0.46 documents); partly fixes LP #182031
(bzr r4461)
Diffstat (limited to 'src/box3d-context.cpp')
| -rw-r--r-- | src/box3d-context.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/box3d-context.cpp b/src/box3d-context.cpp index 78e80be45..68480a00d 100644 --- a/src/box3d-context.cpp +++ b/src/box3d-context.cpp @@ -206,6 +206,24 @@ static void sp_box3d_context_selection_changed(Inkscape::Selection *selection, g } } +/* create a default perspective in document defs if none is present + (can happen after 'vacuum defs' or when a pre-0.46 file is opened) */ +static void sp_box3d_context_check_for_persp_in_defs(SPDocument *document) { + SPDefs *defs = (SPDefs *) SP_DOCUMENT_DEFS(document); + + bool has_persp = false; + for (SPObject *child = sp_object_first_child(defs); child != NULL; child = SP_OBJECT_NEXT(child) ) { + if (SP_IS_PERSP3D(child)) { + has_persp = true; + break; + } + } + + if (!has_persp) { + document->current_persp3d = persp3d_create_xml_element (document); + } +} + static void sp_box3d_context_setup(SPEventContext *ec) { Box3DContext *bc = SP_BOX3D_CONTEXT(ec); @@ -214,6 +232,8 @@ static void sp_box3d_context_setup(SPEventContext *ec) ((SPEventContextClass *) parent_class)->setup(ec); } + sp_box3d_context_check_for_persp_in_defs(sp_desktop_document (ec->desktop)); + SPItem *item = sp_desktop_selection(ec->desktop)->singleItem(); if (item) { ec->shape_knot_holder = sp_item_knot_holder(item, ec->desktop); |
