Logo Search packages:      
Sourcecode: inkscape version File versions  Download package

bool sp_lpe_item_perform_path_effect ( SPLPEItem *  lpeitem,
SPCurve *  curve 
)

returns true when LPE was successful.

Todo:
Investigate the cause of this. For example, this happens when copy pasting an object with LPE applied. Probably because the object is pasted while the effect is not yet pasted to defs, and cannot be found.

Todo:
Investigate the cause of this. Not sure, but I think this can happen when an unknown effect type is specified...

Definition at line 305 of file sp-lpe-item.cpp.

                                                                         {
    if (!lpeitem) return false;
    if (!curve) return false;

    if (sp_lpe_item_has_path_effect(lpeitem) && sp_lpe_item_path_effects_enabled(lpeitem)) {
        for (PathEffectList::iterator it = lpeitem->path_effect_list->begin(); it != lpeitem->path_effect_list->end(); ++it)
        {
            LivePathEffectObject *lpeobj = (*it)->lpeobject;
            if (!lpeobj) {
                /** \todo Investigate the cause of this.
                 * For example, this happens when copy pasting an object with LPE applied. Probably because the object is pasted while the effect is not yet pasted to defs, and cannot be found.
                 */
                g_warning("sp_lpe_item_perform_path_effect - NULL lpeobj in list!");
                return false;
            }
            Inkscape::LivePathEffect::Effect *lpe = lpeobj->get_lpe();
            if (!lpe) {
                /** \todo Investigate the cause of this.
                 * Not sure, but I think this can happen when an unknown effect type is specified...
                 */
                g_warning("sp_lpe_item_perform_path_effect - lpeobj with invalid lpe in the stack!");
                return false;
            }

            if (lpe->isVisible()) {
                if (lpe->acceptsNumClicks() > 0 && !lpe->isReady()) {
                    // if the effect expects mouse input before being applied and the input is not finished
                    // yet, we don't alter the path
                    return false;
                }

                // Groups have their doBeforeEffect called elsewhere
                if (!SP_IS_GROUP(lpeitem)) {
                    lpe->doBeforeEffect(lpeitem);
                }

                try {
                    lpe->doEffect(curve);
                }
                catch (std::exception & e) {
                    g_warning("Exception during LPE %s execution. \n %s", lpe->getName().c_str(), e.what());
                    if (SP_ACTIVE_DESKTOP && SP_ACTIVE_DESKTOP->messageStack()) {
                        SP_ACTIVE_DESKTOP->messageStack()->flash( Inkscape::WARNING_MESSAGE,
                                        _("An exception occurred during execution of the Path Effect.") );
                    }
                    return false;
                }
            }
        }
    }

    return true;
}


Generated by  Doxygen 1.6.0   Back to index