1 /** 2 Property bindings 3 4 Copyright: 5 Copyright © 2020-2026, Inochi2D Project 6 7 License: 8 $(LINK2 https://github.com/Inochi2D/inochi2d/blob/main/LICENSE, BSD 2-clause License) 9 10 Authors: 11 Luna Nielsen 12 Mireille Arseneault 13 Hoshino Lina 14 */ 15 module inochi2d.param.bindings.property; 16 import inochi2d.param.parameters; 17 import inochi2d.param.bindings; 18 import inochi2d.param.utils; 19 import inochi2d.core.vector2d; 20 import inochi2d.core.registry; 21 import inochi2d.core.serde; 22 import inochi2d.core.math; 23 import inochi2d.core.guid; 24 import inochi2d.common; 25 import inochi2d.puppet; 26 import inochi2d.nodes; 27 import nulib; 28 import numem; 29 30 ///** 31 // Parameter binding to a single numeric property. 32 //*/ 33 //@TypeId("property", IN_MAKE_TAG!(0, 0)) 34 //class ParameterPropertyBinding : ParameterNodeBinding { 35 //private: 36 //@nogc: 37 // vector2d!float values_; 38 // nstring prop_; 39 40 //protected: 41 42 // /** 43 // Serialize this parameter binding. 44 // */ 45 // override 46 // void onSerialize(ref DataNode object) { 47 // super.onSerialize(object); 48 // object["values"] = values.data.serialize(); 49 // } 50 51 // /** 52 // Deserialize this parameter. 53 // */ 54 // override 55 // void onDeserialize(ref DataNode object, ref ModelState state) { 56 // super.onDeserialize(object, state); 57 // if (state.doUpgrade08) { 58 // object.tryGetRef(state, prop_, "param_name"); 59 // if ("values" in object) { 60 // object["values"].deserialize08NestedArrays( 61 // values_, 62 // state, 63 // parameter.dimensions == 1 ? 64 // vec2u(1, parameter.elementCounts[0]) : 65 // vec2u(parameter.elementCounts[0], parameter.elementCounts[1]) 66 // ); 67 // } 68 // return; 69 // } 70 71 // object.tryGetRef(state, prop_, "property"); 72 // object.tryGetRef(state, prop_, "property"); 73 // } 74 75 //public: 76 77 // /** 78 // The values of the binding. 79 // */ 80 // @property slice2d!float values() => values_[]; 81 82 // /** 83 // The property that the binding applies to. 84 // */ 85 // @property string property() => prop_[]; 86 // @property void property(string value) { 87 // this.prop_ = value; 88 // } 89 90 // /** 91 // Construct a binding from its parameter. 92 93 // Params: 94 // param = The parameter this binding will belong to. 95 // */ 96 // this(Parameter param) { 97 // super(param); 98 // this.values_.resizeToParam(param); 99 // } 100 101 // /** 102 // Construct a binding from its parameter, target node & target property. 103 104 // Params: 105 // param = The parameter this binding will belong to. 106 // node = The node being affected by this binding. 107 // prop = The target node property being affected by this binding. 108 // */ 109 // this(Parameter param, Node node, string prop) { 110 // super(parameter, node); 111 // this.values_.resizeToParam(param); 112 // this.prop_ = prop; 113 // } 114 115 // /** 116 // Check whether this binding is compatible with the given node. 117 // */ 118 // override 119 // bool isCompatibleWith(Node other) const { 120 // return other.hasProperty(prop_); 121 // } 122 123 // /** 124 // Apply the given value to this binding's target. 125 // */ 126 // void apply(float value) { 127 // target.setProperty(prop_, value); 128 // } 129 130 // /** 131 // Reset keypoint to default based on node property. 132 // */ 133 // void reset(ref float value) const { 134 // value = target.getPropertyDefault(prop_); 135 // } 136 137 // // Add general implementation 138 // mixin ParameterNodeBindingImpl!float; 139 //} 140 //mixin Register!(ParameterPropertyBinding, in_binding_registry);