Skip to content

Commit 927340f

Browse files
committed
time attribute added to SOP
1 parent 7e83550 commit 927340f

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

Plugins/Houdini/aaOceanSOP.cpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ static PRM_Name names[] =
7878
PRM_Name("fetch", "TMA Fetch"),
7979
PRM_Name("swellAmount", "Swell Amount"),
8080
PRM_Name("randWeight", "Random Weight"),
81-
81+
PRM_Name("time", "Time"),
8282
};
8383

8484
// defining some custom ranges and defaults
@@ -101,6 +101,9 @@ static PRM_Default velocityDefault(4.0);
101101
static PRM_Range waveSpeedRange(PRM_RANGE_UI, -10.0, PRM_RANGE_UI, 10.0);
102102
static PRM_Default waveSpeedDefault(1.0);
103103

104+
static PRM_Range timeRange(PRM_RANGE_UI, 0, PRM_RANGE_UI, 1000.0);
105+
static PRM_Default timeRangeDefault(1000.0);
106+
104107
static PRM_Range loopTimeRange(PRM_RANGE_RESTRICTED, 0.001, PRM_RANGE_UI, 1000.0);
105108
static PRM_Default loopTimeDefault(1000.0);
106109

@@ -140,6 +143,7 @@ PRM_Template aaOceanSOP::myTemplateList[] =
140143
PRM_Template(PRM_ORD, PRM_Template::PRM_EXPORT_MAX, 1, &names[17], 0, &spectrumNamesMenu), // spectrum type
141144
PRM_Template(PRM_FLT_J, 1, &names[2], &oceanScaleDefault, 0, &oceanScaleRange), // oceanScale // 2
142145
PRM_Template(PRM_INT_E, 1, &names[1], &seedDefault, 0, &seedRange), // seed // 1
146+
PRM_Template(PRM_FLT_J, 1, &names[23], PRMzeroDefaults, 0, &timeRange), // time // 23
143147
PRM_Template(PRM_FLT_J, 1, &names[14], PRMzeroDefaults, 0, &PRMscaleRange), // timeOffset // 14
144148
PRM_Template(PRM_TOGGLE,1, &names[13]), // enable Foam // 13
145149

@@ -202,9 +206,6 @@ OP_ERROR aaOceanSOP::cookMySop(OP_Context &context)
202206
setCurGdh(0, myGdpHandle);
203207
setupLocalVars();
204208

205-
// variable declarations
206-
float now = context.getTime();
207-
208209
// Flag the SOP as being time dependent (i.e. cook on time changes)
209210
flags().setTimeDep(true);
210211

@@ -245,7 +246,9 @@ OP_ERROR aaOceanSOP::cookMySop(OP_Context &context)
245246
enableEigens = (ENABLEEIGENS() != 0);
246247
if(pOcean->isChoppy() && enableEigens)
247248
enableEigens = TRUE;
248-
now = now + TIMEOFFSET(now);
249+
250+
// variable declarations
251+
float now = context.getTime();
249252

250253
pOcean->input( RESOLUTION(),
251254
SPECTRUM(),
@@ -261,7 +264,7 @@ OP_ERROR aaOceanSOP::cookMySop(OP_Context &context)
261264
WAVESPEED(now),
262265
WAVEHEIGHT(now),
263266
CHOP(now),
264-
now,
267+
TIME(now) + TIMEOFFSET(now),
265268
LOOPTIME(now),
266269
enableEigens,
267270
RANDWEIGHT(now),

Plugins/Houdini/aaOceanSOP.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ class aaOceanSOP : public SOP_Node
7676
fpreal WAVEHEIGHT(fpreal t) { return evalFloat("waveHeight", 0, t); }
7777
fpreal CHOP(fpreal t) { return evalFloat("chop", 0, t); }
7878
int ENABLEEIGENS() { return evalInt("enableEigens", 0, 0); }
79+
fpreal TIME(fpreal t) { return evalFloat("time", 0, t); }
7980
fpreal TIMEOFFSET(fpreal t) { return evalFloat("timeOffset", 0, t); }
8081
fpreal LOOPTIME(fpreal t) { return evalFloat("loopTime", 0, t); }
8182
fpreal RANDWEIGHT(fpreal t) { return evalFloat("randWeight", 0, t); }

0 commit comments

Comments
 (0)