Method TObj_Object::HasModifications() was added to get flag that object or it's children was modified in the current open transaction
order = GetLabel().Tag();
return order;
}
+
+//=======================================================================
+//function : HasModifications
+//purpose :
+//=======================================================================
+
+Standard_Boolean TObj_Object::HasModifications() const
+{
+ return (!IsAlive() ? Standard_False : GetLabel().MayBeModified() );
+}
\ No newline at end of file
//! sets order of object
virtual Standard_EXPORT Standard_Boolean SetOrder( const Standard_Integer& theIndx );
+ public:
+ /**
+ * Public methods to check modifications of the object since last commit
+ */
+ //! Returns true if object attributes or or his children were modified in the current open transaction
+ Standard_EXPORT Standard_Boolean HasModifications() const;
+
+
protected:
/**
* Protected Methods copy data of object to other object
return 0;
}
+//=======================================================================
+//function : hasModifications
+//purpose :
+//=======================================================================
+static Standard_Integer hasModifications(Draw_Interpretor& di, Standard_Integer argc, const char** argv)
+{
+ if (argc < 3)
+ {
+ di << "Use " << argv[0] << "DocName ObjName\n";
+ return 1;
+ }
+
+ Handle(TObjDRAW_Object) tObj = getObjByName(argv[1], argv[2]);
+ if (tObj.IsNull())
+ {
+ di << "Error: Object " << argv[2] << " not found\n";
+ return 1;
+ }
+ di << "Status modifications : " << (tObj->HasModifications() ? 1 : 0) << "\n";
+
+ return 0;
+}
//=======================================================================
//function : Init
//purpose :
di.Add ("TObjGetChildren","DocName ObjName \t: Returns list of children objects",
__FILE__, getChild, g);
+ di.Add("TObjHasModifications", "DocName ObjName \t: Returns status of modification of the object (if object has been modified 1, otherwise 0)", __FILE__, hasModifications, g);
+
}
--- /dev/null
+puts "============"
+puts "OCC31452"
+puts "0031452: Impossible to get Backup of the attribute and status that attribute was modified before commit transaction"
+puts "============"
+
+set BugNumber OCC31452
+set status 0
+
+pload TOBJ
+
+# Create a new document
+TObjNew TD1
+UndoLimit TD1 10
+TObjAddObj TD1 obj1
+TObjAddObj TD1 obj2
+TObjAddObj TD1 obj3
+
+set parent "obj1 obj2 obj2"
+set children "ch11 ch21 ch22"
+for { set i 0} {$i <= 2} {incr i} {
+ set p [lindex $parent $i]
+ set ch [lindex $children $i]
+ TObjAddChild TD1 $p $ch
+}
+
+TObjSetRef TD1 obj1 obj2
+
+TObjSetVal TD1 ch11 200
+TObjSetVal TD1 ch21 110
+TObjSetVal TD1 obj2 -r 3 3.14 2.78 0.123
+OpenCommand TD1
+
+TObjSetVal TD1 ch11 150
+TObjSetVal TD1 obj2 -r 3 3.14 2.78 0.150
+
+for {set i 1} {$i <=2} {incr i} {
+ set out [TObjHasModifications TD1 obj$i]
+ set fields [split $out ":"]
+ set status [lindex $fields 1]
+ if {$status != 1} {
+ puts "Error : status of the modification of the object incorrect"
+ }
+
+}
+
+
+TObjClose TD1
+unset TD1
+
+