diff --git a/NIF_Blocks.h b/NIF_Blocks.h index 29abf7ad80c9a22be03bc769cb1edf3daa4ea2c0..07e581299d9e085e00775b082bcb4391335b1a90 100644 --- a/NIF_Blocks.h +++ b/NIF_Blocks.h @@ -84,6 +84,7 @@ public: vector<attr_ref> GetAttrs(); int GetBlockNum() { return _block_num; } bool IsControllable() { return false; } + bool IsController() { return false; } string asString(); //Links @@ -195,6 +196,7 @@ class AController : public ABlock { public: AController(); void Init() {} + bool IsController() { return true; } ~AController() {} }; diff --git a/nif_attrs.h b/nif_attrs.h index 78711b62af3d8154537d0d34233026460e654307..71bb0abffe365d35d0e7aadbf77832225e4fbe17 100644 --- a/nif_attrs.h +++ b/nif_attrs.h @@ -1268,7 +1268,7 @@ public: ReadUInt(in); } void WriteAttr( ofstream& out, unsigned int version ) { - WriteUInt( _owner->GetParent()->GetBlockNum(), out ); + WriteUInt( FindTarget()->GetBlockNum(), out ); } blk_ref FindTarget() const { //Find first ancestor that is controllable @@ -1301,6 +1301,8 @@ public: return out.str(); } blk_ref asLink() const { return FindTarget(); } + void Set(blk_ref&) { throw runtime_error("The attribute you tried to set is calculated automatically. You cannot change it directly."); } + }; class SkeletonRootAttr : public AAttr { @@ -1355,6 +1357,8 @@ public: return out.str(); } blk_ref asLink() const { return FindRoot(); } + void Set(blk_ref&) { throw runtime_error("The attribute you tried to set is calculated automatically. You cannot change it directly."); } + private: int original_root; }; diff --git a/niflib.h b/niflib.h index 2e24e6c35072b9a51864e41c532a7af3cc81e72f..d4c6941a9b286b2a28f9e9788a241ab8ce2058b9 100644 --- a/niflib.h +++ b/niflib.h @@ -455,6 +455,7 @@ public: virtual string asString() = 0; virtual string GetBlockType() = 0; virtual bool IsControllable() = 0; + virtual bool IsController() = 0; //Attribute Functions virtual attr_ref GetAttr(string attr_name) = 0;