]> OCCT Git - occt.git/commitdiff
// implemented start and end time code
authordpasukhi <dpasukhi@opencascade.com>
Thu, 1 Jun 2023 17:09:26 +0000 (18:09 +0100)
committeroan <oan@opencascade.com>
Tue, 20 Jun 2023 21:33:56 +0000 (22:33 +0100)
src/XCAFDoc/XCAFDoc_AnimationTool.cxx
src/XCAFDoc/XCAFDoc_AnimationTool.hxx

index 10eeea7350df53764a64622b5c1230e7271cba56..bbd8d8647cc614674d78b8b8c89982b4937c05c0 100644 (file)
@@ -36,6 +36,26 @@ namespace
     static Standard_GUID aGlobalFPSID("C7E7AF70-2FB3-40FD-BD38-CC79D9343D7A");
     return aGlobalFPSID;
   }
+
+  //=======================================================================
+  //function : GetStartTimeCodeGUID
+  //purpose  :
+  //=======================================================================
+  const Standard_GUID& GetStartTimeCodeGUID()
+  {
+    static Standard_GUID aStartTimeCodeGUID("379BC1C5-E9DA-4B57-9938-B2612158722A");
+    return aStartTimeCodeGUID;
+  }
+
+  //=======================================================================
+  //function : GetEndTimeCodeGUID
+  //purpose  :
+  //=======================================================================
+  const Standard_GUID& GetEndTimeCodeGUID()
+  {
+    static Standard_GUID aEndTimeCodeGUID("EF5305A3-961D-48AE-9A78-AC744A110A26");
+    return aEndTimeCodeGUID;
+  }
 }
 
 //=======================================================================
@@ -147,6 +167,66 @@ void XCAFDoc_AnimationTool::SetGlobalFPS(const double theFPS) const
   TDataStd_Real::Set(BaseLabel(), GetGlobalFPSGUID(), theFPS);
 }
 
+//=======================================================================
+//function : GetStartTimeCode
+//purpose  :
+//=======================================================================
+bool XCAFDoc_AnimationTool::GetStartTimeCode(double& theCode) const
+{
+  Handle(TDataStd_Real) aCodeAttr;
+  if (BaseLabel().FindAttribute(GetStartTimeCodeGUID(), aCodeAttr))
+  {
+    theCode = aCodeAttr->Get();
+    return true;
+  }
+  return false;
+}
+
+//=======================================================================
+//function : SetStartTimeCode
+//purpose  :
+//=======================================================================
+void XCAFDoc_AnimationTool::SetStartTimeCode(const double theCode) const
+{
+  Handle(TDataStd_Real) aCodeAttr;
+  if (BaseLabel().FindAttribute(GetStartTimeCodeGUID(), aCodeAttr))
+  {
+    aCodeAttr->Set(theCode);
+    return;
+  }
+  TDataStd_Real::Set(BaseLabel(), GetStartTimeCodeGUID(), theCode);
+}
+
+//=======================================================================
+//function : GetEndTimeCode
+//purpose  :
+//=======================================================================
+bool XCAFDoc_AnimationTool::GetEndTimeCode(double& theCode) const
+{
+  Handle(TDataStd_Real) aCodeAttr;
+  if (BaseLabel().FindAttribute(GetEndTimeCodeGUID(), aCodeAttr))
+  {
+    theCode = aCodeAttr->Get();
+    return true;
+  }
+  return false;
+}
+
+//=======================================================================
+//function : SetEndTimeCode
+//purpose  :
+//=======================================================================
+void XCAFDoc_AnimationTool::SetEndTimeCode(const double theCode) const
+{
+  Handle(TDataStd_Real) aCodeAttr;
+  if (BaseLabel().FindAttribute(GetEndTimeCodeGUID(), aCodeAttr))
+  {
+    aCodeAttr->Set(theCode);
+    return;
+  }
+  TDataStd_Real::Set(BaseLabel(), GetEndTimeCodeGUID(), theCode);
+}
+
 //=======================================================================
 //function : GetAnimationLabels
 //purpose  :
index df66527a762371de6deb7ad7ec6073de2bc75bb1..ef85f5118c0603e1a99e5d70e8e0cb394674659d 100644 (file)
@@ -64,6 +64,18 @@ public:
   //!
   Standard_EXPORT void SetGlobalFPS(const double theFPS) const;
 
+  //!
+  Standard_EXPORT bool GetStartTimeCode(double& theCode) const;
+
+  //!
+  Standard_EXPORT void SetStartTimeCode(const double theCode) const;
+
+  //!
+  Standard_EXPORT bool GetEndTimeCode(double& theCode) const;
+
+  //!
+  Standard_EXPORT void SetEndTimeCode(const double theCode) const;
+
   //! Returns a sequence of Animation labels currently stored
   //! in the Animation table.
   Standard_EXPORT void GetAnimationLabels(TDF_LabelSequence& theLabels) const;