Commit 71e9c4e1 authored by Jan Möbius's avatar Jan Möbius

Moved VsiMetadata for move into move plugin

Added scripting functions to modify the scenegraph matrix



git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@16485 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 19e068f1
......@@ -12,4 +12,5 @@ if (EXISTS ${CMAKE_SOURCE_DIR}/ObjectTypes/Skeleton)
add_definitions (-DENABLE_SKELETON_SUPPORT)
endif ()
openflipper_plugin ( TSplineMesh TRANSLATION_LANGUAGES de_DE INSTALLDATA Icons )
openflipper_plugin ( TRANSLATION_LANGUAGES de_DE
INSTALLDATA Icons VsiMetadata )
......@@ -509,6 +509,43 @@ public slots :
/// Get the z-direction of the manipulator
Vector manipulatorDirectionZ( int _objectId );
/** \brief Sets the Object Matrix in the scenegraph to identity
*/
void objectRenderingMatrixIdentity(int _objectId);
/** \brief Adds a scaling factor to the Object rendering Matrix in the scenegraph
*
* @param _objectId Id of the object to modify
* @param _s Scaling factor
*/
void objectRenderingMatrixScale(int _objectId, double _s);
/** \brief Adds a scaling factor to the Object rendering Matrix in the scenegraph
*
* @param _objectId Id of the object to modify
* @param _translation Translation vector
*/
void objectRenderingMatrixTranslate(int _objectId, Vector _translation);
/** \brief Adds a scaling factor to the Object rendering Matrix in the scenegraph
*
* @param _objectId Id of the object to modify
* @param _axis Rotation axis
* @param _angle Rotation angle
*/
void objectRenderingMatrixRotate(int _objectId, Vector _axis, double _angle);
/** \brief Gets the Object Matrix in the scenegraph
*
* The object itself is not modified b< this matrix. Only the transformation matrix applied to the object
* coordinates before rendering gets modified.
*
* @param _objectId Id of the object to modify
* @return Current Matrix of the object
*/
Matrix4x4 getObjectRenderingMatrix(int _objectId);
/** @} */
public slots:
......
......@@ -103,6 +103,25 @@ void MovePlugin::setDescriptions(){
emit setSlotDescription("manipulatorDirectionZ(int)",tr("Returns the z-direction of an object's manipulator."),
QStringList(tr("objectId")), QStringList(tr("ID of an object")));
emit setSlotDescription("objectRenderingMatrixIdentity(int)",tr("Resets the objects rendering matrix to identity."),
QStringList(tr("objectId")), QStringList(tr("ID of an object")));
emit setSlotDescription("objectRenderingMatrixScale(int,double)",tr("Adds a scaling factor to the Object rendering Matrix in the scenegraph."),
QStringList(tr("objectId;Scaling Factor").split(";")), QStringList(tr("ID of an object; Scaling factor").split(";")));
emit setSlotDescription("objectRenderingMatrixTranslate(int,Vector)",tr("Adds a translation to the Object rendering Matrix in the scenegraph."),
QStringList(tr("objectId;translation vector").split(";")), QStringList(tr("ID of an object;Translation vector").split(";")));
emit setSlotDescription("objectRenderingMatrixRotate(int,Vector,double)",tr("Adds a Rotation to the Object rendering Matrix in the scenegraph."),
QStringList(tr("objectId;rotation axis;angle").split(";")), QStringList(tr("ID of an object;Rotation axis;angle").split(";")));
emit setSlotDescription("getObjectRenderingMatrix(int)",tr("Returns the current object transformation matrix from the scenegraph."),
QStringList(tr("objectId").split(";")), QStringList(tr("ID of an object").split(";")));
}
......@@ -1213,3 +1232,77 @@ Vector MovePlugin::manipulatorDirectionZ( int _objectId ){
return (Vector) object->manipulatorNode()->directionZ();
}
//------------------------------------------------------------------------------
void MovePlugin::objectRenderingMatrixIdentity(int _objectId) {
BaseObjectData* object;
if ( ! PluginFunctions::getObject(_objectId,object) ) {
emit log(LOGERR,tr("objectRenderingMatrixIdentity : unable to get object" ));
return ;
}
object->manipulatorNode()->loadIdentity();
emit updatedObject(_objectId,UPDATE_VISIBILITY);
}
//------------------------------------------------------------------------------
void MovePlugin::objectRenderingMatrixScale(int _objectId, double _s) {
BaseObjectData* object;
if ( ! PluginFunctions::getObject(_objectId,object) ) {
emit log(LOGERR,tr("objectRenderingMatrixScale : unable to get object" ));
return ;
}
object->manipulatorNode()->scale(_s);
emit updatedObject(_objectId,UPDATE_VISIBILITY);
}
//------------------------------------------------------------------------------
void MovePlugin::objectRenderingMatrixTranslate(int _objectId, Vector _translation) {
BaseObjectData* object;
if ( ! PluginFunctions::getObject(_objectId,object) ) {
emit log(LOGERR,tr("objectRenderingMatrixTranslate : unable to get object" ));
return ;
}
object->manipulatorNode()->translate(_translation);
emit updatedObject(_objectId,UPDATE_VISIBILITY);
}
//------------------------------------------------------------------------------
void MovePlugin::objectRenderingMatrixRotate(int _objectId, Vector _axis, double _angle) {
BaseObjectData* object;
if ( ! PluginFunctions::getObject(_objectId,object) ) {
emit log(LOGERR,tr("objectRenderingMatrixRotate : unable to get object" ));
return ;
}
object->manipulatorNode()->rotate(_angle,_axis);
emit updatedObject(_objectId,UPDATE_VISIBILITY);
}
//------------------------------------------------------------------------------
Matrix4x4 MovePlugin::getObjectRenderingMatrix(int _objectId) {
BaseObjectData* object;
if ( ! PluginFunctions::getObject(_objectId,object) ) {
emit log(LOGERR,tr("getObjectRenderingMatrix : unable to get object" ));
return Matrix4x4();
}
return object->manipulatorNode()->matrix();
}
<OpenFlipper>
<element name="move_translate">
<category>Object Manipulation</category>
<short>Move/rotate</short>
<long>Translates and transforms all vertices of an object.</long>
<dataflow>true</dataflow>
<inputs>
<input name="obj" type="ObjectId">
<short>ID</short>
<long>ID of an object</long>
</input>
<input name="vec" type="Vector">
<short>Translation vector</short>
<long>Vector to translate with</long>
</input>
<input name="mat" type="Matrix">
<short>Transformation matrix</short>
<long>Matrix to transform with</long>
</input>
</inputs>
<code>
move.translate([input="obj"], [input="vec"]);
move.transform([input="obj"], [input="mat"]);
</code>
</element>
<element name="move_rendering_matrixi_identity">
<category>Object Manipulation</category>
<short>Scenegraph matrix identity</short>
<long>Resets the scenegraph matrix used for rendering to identity</long>
<dataflow>true</dataflow>
<inputs>
<input name="obj" type="ObjectId">
<short>ID</short>
<long>ID of an object</long>
</input>
</inputs>
<code>
move.objectRenderingMatrixIdentity([input="obj"]);
</code>
</element>
<element name="move_rendering_matrix_scale">
<category>Object Manipulation</category>
<short>Scenegraph matrix scale</short>
<long>Adds a scaling factor to the scenegraph matrix used for rendering</long>
<dataflow>true</dataflow>
<inputs>
<input name="obj" type="ObjectId">
<short>ID</short>
<long>ID of an object</long>
</input>
<input name="factor" type="Number">
<short>scaling factor</short>
<long>Scaling factor</long>
</input>
</inputs>
<code>
move.objectRenderingMatrixScale([input="obj"],[input="factor"]);
</code>
</element>
<element name="move_rendering_matrix_translate">
<category>Object Manipulation</category>
<short>Scenegraph matrix translate</short>
<long>Adds a translation to the scenegraph matrix used for rendering</long>
<dataflow>true</dataflow>
<inputs>
<input name="obj" type="ObjectId">
<short>ID</short>
<long>ID of an object</long>
</input>
<input name="translation" type="Vector">
<short>translation vector</short>
<long>translation vector</long>
</input>
</inputs>
<code>
move.objectRenderingMatrixTranslate([input="obj"],[input="translation"]);
</code>
</element>
<element name="move_rendering_matrix_rotate">
<category>Object Manipulation</category>
<short>Scenegraph matrix rotate</short>
<long>Adds a rotation to the scenegraph matrix used for rendering</long>
<dataflow>true</dataflow>
<inputs>
<input name="obj" type="ObjectId">
<short>ID</short>
<long>ID of an object</long>
</input>
<input name="axis" type="Vector">
<short>rotation axis</short>
<long>rotation axis</long>
</input>
<input name="angle" type="Number">
<short>rotation anlge</short>
<long>rotation ange</long>
</input>
</inputs>
<code>
move.objectRenderingMatrixrotate([input="obj"],[input="axis"],[input="angle"]);
</code>
</element>
</OpenFlipper>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment