Skip to content

Commit bf5d2a3

Browse files
committed
changed 'constant' object name to 'number' and added naming capabilities to better understand patch connections
1 parent 0389246 commit bf5d2a3

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

src/objects/math/Constant.cpp

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
//--------------------------------------------------------------
3636
Constant::Constant() :
3737
// Extend the classes you need
38-
PatchObject("constant"),
38+
PatchObject("number"),
3939

4040
// define default values
4141
inputValueNew(0.f, "")
@@ -85,6 +85,7 @@ void Constant::setupObjectContent(shared_ptr<ofAppGLFWWindow> &mainWindow){
8585

8686
//--------------------------------------------------------------
8787
void Constant::updateObjectContent(map<int,shared_ptr<PatchObject>> &patchObjects){
88+
unusedArgs(patchObjects);
8889

8990
if(this->inletsConnected[0]){
9091
if(*(float *)&_inletParams[0] < 1.0){
@@ -118,6 +119,7 @@ void Constant::updateObjectContent(map<int,shared_ptr<PatchObject>> &patchObject
118119

119120
//--------------------------------------------------------------
120121
void Constant::drawObjectContent(ofTrueTypeFont *font, shared_ptr<ofBaseGLRenderer>& glRenderer){
122+
unusedArgs(font,glRenderer);
121123
ofSetColor(255);
122124
}
123125

@@ -159,14 +161,26 @@ void Constant::drawObjectNodeGui( ImGuiEx::NodeCanvas& _nodeCanvas ){
159161

160162
//--------------------------------------------------------------
161163
void Constant::drawObjectNodeConfig(){
164+
165+
ImGui::Spacing();
166+
ImGui::PushItemWidth(80*scaleFactor);
167+
ImGui::InputText("Variable name",&varName);
168+
ImGui::Spacing();
169+
if(ImGui::Button("APPLY",ImVec2(224*scaleFactor,26*scaleFactor))){
170+
this->setSpecialName("| "+varName);
171+
filepath = this->getSpecialName();
172+
this->saveConfig(false);
173+
}
174+
175+
162176
ImGuiEx::ObjectInfo(
163177
"Single numeric value controller.",
164178
"https://mosaic.d3cod3.org/reference.php?r=constant", scaleFactor);
165179
}
166180

167181
//--------------------------------------------------------------
168182
void Constant::removeObjectContent(bool removeFileFromData){
169-
183+
unusedArgs(removeFileFromData);
170184
}
171185

172-
OBJECT_REGISTER( Constant, "constant", OFXVP_OBJECT_CAT_MATH)
186+
OBJECT_REGISTER( Constant, "number", OFXVP_OBJECT_CAT_MATH)

src/objects/math/Constant.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@ class Constant : public PatchObject {
5353
ofxVPObjectParameter<float> inputValueNew;
5454
bool bang;
5555
bool nextFrame;
56+
string varName;
5657

57-
bool loaded;
58+
bool loaded;
5859

5960
private:
6061

0 commit comments

Comments
 (0)