Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes one Extension and two PartDesign bugs #354

Merged
merged 3 commits into from
Nov 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/App/Extension.h
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ class ExtensionPythonT : public ExtensionT

ExtensionPythonT() {
ExtensionT::m_isPythonExtension = true;
ExtensionT::initExtension(ExtensionPythonT::getExtensionClassTypeId());

EXTENSION_ADD_PROPERTY(ExtensionProxy,(Py::Object()));
}
Expand Down
3 changes: 3 additions & 0 deletions src/Mod/PartDesign/App/Body.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,9 @@ bool Body::isAllowed(const App::DocumentObject* f)

Body* Body::findBodyOf(const App::DocumentObject* feature)
{
if(!feature)
return nullptr;

return static_cast<Body*>(BodyBase::findBodyOf(feature));
}

Expand Down
13 changes: 7 additions & 6 deletions src/Mod/PartDesign/Gui/TaskMirroredParameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,14 @@ void TaskMirroredParameters::onSelectionChanged(const Gui::SelectionChanges& msg
}
exitSelectionMode();
} else {
if ( selectionMode == reference) {
std::vector<std::string> mirrorPlanes;
App::DocumentObject* selObj;
PartDesign::Mirrored* pcMirrored = static_cast<PartDesign::Mirrored*>(getObject());
getReferencedSelection(pcMirrored, msg, selObj, mirrorPlanes);
if (!selObj)
std::vector<std::string> mirrorPlanes;
App::DocumentObject* selObj;
PartDesign::Mirrored* pcMirrored = static_cast<PartDesign::Mirrored*>(getObject());
getReferencedSelection(pcMirrored, msg, selObj, mirrorPlanes);
if (!selObj)
return;

if ( selectionMode == reference || selObj->isDerivedFrom ( App::Plane::getClassTypeId () ) ) {
pcMirrored->MirrorPlane.setValue(selObj, mirrorPlanes);
recomputeFeature();
updateUI();
Expand Down
13 changes: 7 additions & 6 deletions src/Mod/PartDesign/Gui/TaskPolarPatternParameters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,13 +242,14 @@ void TaskPolarPatternParameters::onSelectionChanged(const Gui::SelectionChanges&
exitSelectionMode();
}
else {
if (selectionMode == reference) {
std::vector<std::string> axes;
App::DocumentObject* selObj;
PartDesign::PolarPattern* pcPolarPattern = static_cast<PartDesign::PolarPattern*>(getObject());
getReferencedSelection(pcPolarPattern, msg, selObj, axes);
if(!selObj)
std::vector<std::string> axes;
App::DocumentObject* selObj;
PartDesign::PolarPattern* pcPolarPattern = static_cast<PartDesign::PolarPattern*>(getObject());
getReferencedSelection(pcPolarPattern, msg, selObj, axes);
if(!selObj)
return;

if (selectionMode == reference || selObj->isDerivedFrom ( App::Line::getClassTypeId () ) ) {
pcPolarPattern->Axis.setValue(selObj, axes);
recomputeFeature();
updateUI();
Expand Down
14 changes: 14 additions & 0 deletions src/Mod/Test/Document.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,20 @@ def allowObject(self, obj):
del obj
del grp
del grp2

def testExtensionBug0002785(self):

class MyExtension():
def __init__(self, obj):
obj.addExtension("App::GroupExtensionPython", self)

obj = self.Doc.addObject("App::DocumentObject", "myObj")
MyExtension(obj)
self.failUnless(obj.hasExtension("App::GroupExtension"))
self.failUnless(obj.hasExtension("App::GroupExtensionPython"))
self.Doc.removeObject(obj.Name)
del obj


def tearDown(self):
#closing doc
Expand Down