mirror of
https://github.com/lucaspalomodevelop/meshlab.git
synced 2026-03-20 03:16:10 +00:00
added support for added support for meshes inside script system
This commit is contained in:
parent
f565611412
commit
a32c469ffb
@ -52,6 +52,7 @@
|
||||
<xs:element ref='COLOR_GUI'/>
|
||||
<xs:element ref='SLIDER_GUI'/>
|
||||
<xs:element ref='ENUM_GUI'/>
|
||||
<xs:element ref='MESH_GUI'/>
|
||||
</xs:choice>
|
||||
</xs:sequence>
|
||||
<xs:attribute name='parType' use='required'>
|
||||
@ -61,8 +62,8 @@
|
||||
<xs:pattern value='Int'/>
|
||||
<xs:pattern value='Real'/>
|
||||
<xs:pattern value='Vec3'/>
|
||||
<xs:pattern value='Integer'/>
|
||||
<xs:pattern value='Color'/>
|
||||
<xs:pattern value='Mesh'/>
|
||||
<xs:pattern value='Enum \{(\s*\S+\s*\:\s*\d+\s*(\|)?)+\}'/>
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
@ -124,6 +125,12 @@
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:element name='MESH_GUI'>
|
||||
<xs:complexType>
|
||||
<xs:attribute name='guiLabel' type='xs:string' use='required'/>
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
|
||||
<xs:simpleType name="ArietyType">
|
||||
<xs:restriction base="xs:string">
|
||||
<xs:enumeration value="SingleMesh"/>
|
||||
|
||||
@ -410,6 +410,15 @@ Q_INVOKABLE MeshModelScriptInterface* MeshDocumentScriptInterface::current()
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Q_INVOKABLE int MeshDocumentScriptInterface::currentId()
|
||||
{
|
||||
MeshModel* model = md->mm();
|
||||
if (model != NULL)
|
||||
return model->id();
|
||||
else
|
||||
return -1;
|
||||
}
|
||||
|
||||
Q_INVOKABLE int MeshDocumentScriptInterface::setCurrent(const int meshId)
|
||||
{
|
||||
int id = md->mm()->id();
|
||||
@ -503,6 +512,11 @@ int EnvWrap::evalEnum( const QString& nm )
|
||||
return evalInt(nm);
|
||||
}
|
||||
|
||||
int EnvWrap::evalMesh(const QString& nm)
|
||||
{
|
||||
return evalInt(nm);
|
||||
}
|
||||
|
||||
QColor EnvWrap::evalColor( const QString& nm )
|
||||
{
|
||||
QScriptValue result = evalExp(nm);
|
||||
|
||||
@ -73,6 +73,7 @@ public:
|
||||
|
||||
Q_INVOKABLE MeshModelScriptInterface* getMesh(const int meshId);
|
||||
Q_INVOKABLE MeshModelScriptInterface* current();
|
||||
Q_INVOKABLE int currentId();
|
||||
Q_INVOKABLE int setCurrent(const int meshId);
|
||||
MeshDocument* md;
|
||||
};
|
||||
@ -148,6 +149,7 @@ public:
|
||||
/*QString getExpType(const QString& nm);*/
|
||||
QString evalString(const QString& nm);
|
||||
int evalEnum( const QString& nm );
|
||||
int evalMesh(const QString& nm);
|
||||
};
|
||||
|
||||
QScriptValue EnvWrap_ctor(QScriptContext* c,QScriptEngine* e);
|
||||
|
||||
@ -52,12 +52,6 @@ QString XMLFilterInfo::floatGuiInfo(const QString& guiType,const QString& xmlvar
|
||||
return defaultGuiInfo(guiType,xmlvariable) + externalSep() + MLXMLElNames::guiMinExpr + "={data(" + xmlvariable + "/@" + MLXMLElNames::guiMinExpr + ")}" + externalSep() + MLXMLElNames::guiMaxExpr + "={data(" + xmlvariable + "/@" + MLXMLElNames::guiMaxExpr + ")}";
|
||||
}
|
||||
|
||||
QString XMLFilterInfo::enumGuiInfo( const QString& guiType,const QString& xmlvariable )
|
||||
{
|
||||
return defaultGuiInfo(guiType,xmlvariable) + externalSep() + MLXMLElNames::guiValuesList + "={data(" + xmlvariable + "/@" + MLXMLElNames::guiValuesList + ")}";
|
||||
|
||||
}
|
||||
|
||||
QString XMLFilterInfo::guiTypeSwitchQueryText(const QString& var)
|
||||
{
|
||||
QString base("typeswitch(" + var + ")");
|
||||
@ -68,8 +62,9 @@ QString XMLFilterInfo::guiTypeSwitchQueryText(const QString& var)
|
||||
QString caseCOLOR("case element (" + MLXMLElNames::colorWidgetTag + ") return <p>" + defaultGuiInfo(MLXMLElNames::colorWidgetTag,var) + "</p>/string()");
|
||||
QString caseSLIDER("case element (" + MLXMLElNames::sliderWidgetTag + ") return <p>" + floatGuiInfo(MLXMLElNames::sliderWidgetTag,var) + "</p>/string()");
|
||||
QString caseENUM("case element (" + MLXMLElNames::enumWidgetTag + ") return <p>" + defaultGuiInfo(MLXMLElNames::enumWidgetTag,var) + "</p>/string()");
|
||||
QString caseMESH("case element (" + MLXMLElNames::meshWidgetTag + ") return <p>" + defaultGuiInfo(MLXMLElNames::meshWidgetTag,var) + "</p>/string()");
|
||||
QString errorMsg = "default return \"" + XMLFilterInfo::guiErrorMsg() + "\"";
|
||||
return base + " " + caseABS + " " + caseBOOL + " " + caseEDIT + " " + caseVEC + " " + caseCOLOR + " " + caseSLIDER + " " + caseENUM + " " + errorMsg;
|
||||
return base + " " + caseABS + " " + caseBOOL + " " + caseEDIT + " " + caseVEC + " " + caseCOLOR + " " + caseSLIDER + " " + caseENUM + " " + caseMESH + " " + errorMsg;
|
||||
}
|
||||
|
||||
QStringList XMLFilterInfo::filterNames() const
|
||||
|
||||
@ -62,7 +62,8 @@ namespace MLXMLElNames
|
||||
const QString colorWidgetTag("COLOR_GUI");
|
||||
const QString sliderWidgetTag("SLIDER_GUI");
|
||||
const QString enumWidgetTag("ENUM_GUI");
|
||||
|
||||
const QString meshWidgetTag("MESH_GUI");
|
||||
|
||||
const QString mfiVersion("mfiVersion");
|
||||
|
||||
const QString pluginScriptName("pluginName");
|
||||
@ -98,6 +99,7 @@ namespace MLXMLElNames
|
||||
const QString vec3Type("Vec3");
|
||||
const QString colorType("Color");
|
||||
const QString enumType("Enum");
|
||||
const QString meshType("Mesh");
|
||||
|
||||
//ariety values
|
||||
const QString singleMeshAriety("SingleMesh");
|
||||
@ -117,7 +119,6 @@ private:
|
||||
|
||||
static QString defaultGuiInfo(const QString& guiType,const QString& xmlvariable);
|
||||
static QString floatGuiInfo(const QString& guiType,const QString& xmlvariable);
|
||||
static QString enumGuiInfo(const QString& guiType,const QString& xmlvariable);
|
||||
static QString guiErrorMsg() {return QString("Error: Unknown GUI widget requested");}
|
||||
static QString guiTypeSwitchQueryText(const QString& var);
|
||||
inline static const QString externalSep() {return QString("^");}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user