Extensions: Revert few changes after restructuring
This commit is contained in:
parent
b7d2943217
commit
558e128b39
|
@ -49,7 +49,7 @@ const App::PropertyData & _class_::extensionGetPropertyData(void) const{return p
|
|||
App::PropertyData _class_::propertyData; \
|
||||
void _class_::init(void){\
|
||||
initSubclass(_class_::classTypeId, #_class_ , #_parentclass_, &(_class_::create) ); \
|
||||
_class_::propertyData.addParentPropertyData(_parentclass_::extensionGetPropertyDataPtr());\
|
||||
_class_::propertyData.parentPropertyData = _parentclass_::extensionGetPropertyDataPtr();\
|
||||
}
|
||||
|
||||
#define EXTENSION_PROPERTY_SOURCE_TEMPLATE(_class_, _parentclass_) \
|
||||
|
@ -59,7 +59,7 @@ template<> const App::PropertyData * _class_::extensionGetPropertyDataPtr(void){
|
|||
template<> const App::PropertyData & _class_::extensionGetPropertyData(void) const{return propertyData;} \
|
||||
template<> void _class_::init(void){\
|
||||
initSubclass(_class_::classTypeId, #_class_ , #_parentclass_, &(_class_::create) ); \
|
||||
_class_::propertyData.addParentPropertyData(_parentclass_::extensionGetPropertyDataPtr());\
|
||||
_class_::propertyData.parentPropertyData = _parentclass_::extensionGetPropertyDataPtr();\
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -192,7 +192,7 @@ const App::PropertyData & _class_::getPropertyData(void) const{return propertyDa
|
|||
App::PropertyData _class_::propertyData; \
|
||||
void _class_::init(void){\
|
||||
initSubclass(_class_::classTypeId, #_class_ , #_parentclass_, &(_class_::create) ); \
|
||||
_class_::propertyData.addParentPropertyData(_parentclass_::getPropertyDataPtr());\
|
||||
_class_::propertyData.parentPropertyData = _parentclass_::getPropertyDataPtr();\
|
||||
}
|
||||
|
||||
} //App
|
||||
|
|
|
@ -687,7 +687,7 @@ void ObjectIdentifier::resolve(ResolveResults &results) const
|
|||
/* Yes -- then this must be a property, so we get the document object's name from the owner */
|
||||
bool byIdentifier;
|
||||
|
||||
results.resolvedDocumentObjectName = String(dynamic_cast<const DocumentObject*>(owner)->getNameInDocument(), false, true);
|
||||
results.resolvedDocumentObjectName = String(static_cast<const DocumentObject*>(owner)->getNameInDocument(), false, true);
|
||||
results.resolvedDocumentObject = getDocumentObject(results.resolvedDocument, results.resolvedDocumentObjectName, byIdentifier);
|
||||
results.propertyName = components[0].name.getString();
|
||||
if (results.resolvedDocumentObject)
|
||||
|
@ -717,12 +717,12 @@ void ObjectIdentifier::resolve(ResolveResults &results) const
|
|||
if (documentName.getString().size() > 0) {
|
||||
/* Yes; then document object must follow */
|
||||
results.resolvedDocumentObjectName = String(components[0].name, false, false);
|
||||
results.resolvedDocumentObject = results.resolvedDocument->getObject(dynamic_cast<const DocumentObject*>(owner)->getNameInDocument());
|
||||
results.resolvedDocumentObject = results.resolvedDocument->getObject(static_cast<const DocumentObject*>(owner)->getNameInDocument());
|
||||
results.propertyIndex = 1;
|
||||
}
|
||||
else {
|
||||
/* No, assume component is a property, and get document object's name from owner */
|
||||
const DocumentObject * docObj = dynamic_cast<const DocumentObject*>(owner);
|
||||
const DocumentObject * docObj = static_cast<const DocumentObject*>(owner);
|
||||
results.resolvedDocument = docObj->getDocument();
|
||||
results.resolvedDocumentName = String(results.resolvedDocument->getName(), false, true);
|
||||
results.resolvedDocumentObjectName = String(docObj->getNameInDocument(), false, true);
|
||||
|
|
|
@ -278,24 +278,14 @@ void PropertyData::addProperty(OffsetBase offsetBase,const char* PropName, Prope
|
|||
}
|
||||
}
|
||||
|
||||
void PropertyData::addParentPropertyData(const PropertyData* data) {
|
||||
|
||||
if(data)
|
||||
parentPropertyData.push_back(data);
|
||||
}
|
||||
|
||||
|
||||
const PropertyData::PropertySpec *PropertyData::findProperty(OffsetBase offsetBase,const char* PropName) const
|
||||
{
|
||||
for (vector<PropertyData::PropertySpec>::const_iterator It = propertyData.begin(); It != propertyData.end(); ++It)
|
||||
if(strcmp(It->Name,PropName)==0)
|
||||
return &(*It);
|
||||
|
||||
for(auto data : parentPropertyData) {
|
||||
auto res = data->findProperty(offsetBase,PropName);
|
||||
if(res)
|
||||
return res;
|
||||
}
|
||||
if(parentPropertyData)
|
||||
return parentPropertyData->findProperty(offsetBase,PropName);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -308,11 +298,8 @@ const PropertyData::PropertySpec *PropertyData::findProperty(OffsetBase offsetBa
|
|||
if(diff == It->Offset)
|
||||
return &(*It);
|
||||
|
||||
for(auto data : parentPropertyData) {
|
||||
auto res = data->findProperty(offsetBase,prop);
|
||||
if(res)
|
||||
return res;
|
||||
}
|
||||
if(parentPropertyData)
|
||||
return parentPropertyData->findProperty(offsetBase,prop);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -462,8 +449,8 @@ void PropertyData::getPropertyMap(OffsetBase offsetBase,std::map<std::string,Pro
|
|||
}
|
||||
*/
|
||||
|
||||
for(auto data : parentPropertyData)
|
||||
data->getPropertyMap(offsetBase,Map);
|
||||
if(parentPropertyData)
|
||||
parentPropertyData->getPropertyMap(offsetBase,Map);
|
||||
|
||||
}
|
||||
|
||||
|
@ -478,8 +465,8 @@ void PropertyData::getPropertyList(OffsetBase offsetBase,std::vector<Property*>
|
|||
{
|
||||
List.push_back((Property *) (pos->second.Offset + (char *)container) );
|
||||
}*/
|
||||
for(auto data : parentPropertyData)
|
||||
data->getPropertyList(offsetBase,List);
|
||||
if(parentPropertyData)
|
||||
parentPropertyData->getPropertyList(offsetBase,List);
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -77,11 +77,10 @@ struct AppExport PropertyData
|
|||
};
|
||||
|
||||
// vector of all properties
|
||||
std::vector<PropertySpec> propertyData;
|
||||
std::vector<const PropertyData*> parentPropertyData;
|
||||
std::vector<PropertySpec> propertyData;
|
||||
const PropertyData* parentPropertyData;
|
||||
|
||||
void addProperty(OffsetBase offsetBase,const char* PropName, Property *Prop, const char* PropertyGroup= 0, PropertyType = Prop_None, const char* PropertyDocu= 0 );
|
||||
void addParentPropertyData(const PropertyData* data);
|
||||
|
||||
const PropertySpec *findProperty(OffsetBase offsetBase,const char* PropName) const;
|
||||
const PropertySpec *findProperty(OffsetBase offsetBase,const Property* prop) const;
|
||||
|
@ -239,7 +238,7 @@ const App::PropertyData & _class_::getPropertyData(void) const{return propertyDa
|
|||
App::PropertyData _class_::propertyData; \
|
||||
void _class_::init(void){\
|
||||
initSubclass(_class_::classTypeId, #_class_ , #_parentclass_, &(_class_::create) ); \
|
||||
_class_::propertyData.addParentPropertyData(_parentclass_::getPropertyDataPtr());\
|
||||
_class_::propertyData.parentPropertyData = _parentclass_::getPropertyDataPtr(); \
|
||||
}
|
||||
|
||||
#define PROPERTY_SOURCE_ABSTRACT(_class_, _parentclass_) \
|
||||
|
@ -249,7 +248,7 @@ const App::PropertyData & _class_::getPropertyData(void) const{return propertyDa
|
|||
App::PropertyData _class_::propertyData; \
|
||||
void _class_::init(void){\
|
||||
initSubclass(_class_::classTypeId, #_class_ , #_parentclass_, &(_class_::create) ); \
|
||||
_class_::propertyData.addParentPropertyData(_parentclass_::getPropertyDataPtr());\
|
||||
_class_::propertyData.parentPropertyData = _parentclass_::getPropertyDataPtr(); \
|
||||
}
|
||||
|
||||
#define TYPESYSTEM_SOURCE_TEMPLATE(_class_) \
|
||||
|
@ -267,7 +266,7 @@ template<> const App::PropertyData * _class_::getPropertyDataPtr(void){return &p
|
|||
template<> const App::PropertyData & _class_::getPropertyData(void) const{return propertyData;} \
|
||||
template<> void _class_::init(void){\
|
||||
initSubclass(_class_::classTypeId, #_class_ , #_parentclass_, &(_class_::create) ); \
|
||||
_class_::propertyData.addParentPropertyData(_parentclass_::getPropertyDataPtr());\
|
||||
_class_::propertyData.parentPropertyData = _parentclass_::getPropertyDataPtr(); \
|
||||
}
|
||||
|
||||
} // namespace App
|
||||
|
|
|
@ -243,10 +243,8 @@ PyObject *PropertyContainerPy::getCustomAttributes(const char* attr) const
|
|||
getPropertyContainerPtr()->getPropertyMap(Map);
|
||||
PyObject *dict = PyDict_New();
|
||||
if (dict) {
|
||||
for ( std::map<std::string,App::Property*>::iterator it = Map.begin(); it != Map.end(); ++it ){
|
||||
Base::Console().Message("Dict add property: %s\n",it->first.c_str());
|
||||
for ( std::map<std::string,App::Property*>::iterator it = Map.begin(); it != Map.end(); ++it )
|
||||
PyDict_SetItem(dict, PyString_FromString(it->first.c_str()), PyString_FromString(""));
|
||||
}
|
||||
if (PyErr_Occurred()) {
|
||||
Py_DECREF(dict);
|
||||
dict = NULL;
|
||||
|
|
|
@ -89,9 +89,8 @@ std::string PropertyFileIncluded::getDocTransientPath(void) const
|
|||
{
|
||||
std::string path;
|
||||
PropertyContainer *co = getContainer();
|
||||
auto obj = dynamic_cast<DocumentObject*>(co);
|
||||
if (obj) {
|
||||
path = obj->getDocument()->TransientDir.getValue();
|
||||
if (co->isDerivedFrom(DocumentObject::getClassTypeId())) {
|
||||
path = static_cast<DocumentObject*>(co)->getDocument()->TransientDir.getValue();
|
||||
std::replace(path.begin(), path.end(), '\\', '/');
|
||||
}
|
||||
return path;
|
||||
|
|
|
@ -130,7 +130,8 @@ void PropertyLink::Restore(Base::XMLReader &reader)
|
|||
assert(getContainer()->getTypeId().isDerivedFrom(App::DocumentObject::getClassTypeId()) );
|
||||
|
||||
if (name != "") {
|
||||
DocumentObject* parent = static_cast<DocumentObject*>(getContainer());
|
||||
DocumentObject* parent = static_cast<DocumentObject*>(getContainer());
|
||||
|
||||
App::Document* document = parent->getDocument();
|
||||
DocumentObject* object = document ? document->getObject(name.c_str()) : 0;
|
||||
if (!object) {
|
||||
|
@ -479,9 +480,7 @@ void PropertyLinkSub::Restore(Base::XMLReader &reader)
|
|||
|
||||
DocumentObject *pcObject;
|
||||
if (!name.empty()) {
|
||||
|
||||
auto* parent = static_cast<DocumentObject*>(getContainer());
|
||||
App::Document* document = parent->getDocument();
|
||||
App::Document* document = static_cast<DocumentObject*>(getContainer())->getDocument();
|
||||
pcObject = document ? document->getObject(name.c_str()) : 0;
|
||||
if (!pcObject) {
|
||||
if (reader.isVerbose()) {
|
||||
|
|
|
@ -298,7 +298,6 @@ FreeCADGui_subgraphFromObject(PyObject * /*self*/, PyObject *args)
|
|||
PyObject* proxy = 0;
|
||||
proxy = Base::Interpreter().createSWIGPointerObj("pivy.coin", type.c_str(), (void*)node, 1);
|
||||
return Py::new_reference_to(Py::Object(proxy, true));
|
||||
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
if (node) node->unref();
|
||||
|
|
|
@ -1,4 +0,0 @@
|
|||
[Dolphin]
|
||||
PreviewsShown=true
|
||||
Timestamp=2016,5,27,8,10,53
|
||||
Version=3
|
Loading…
Reference in New Issue
Block a user