示例#1
0
void pWidget::setGeometry(Geometry geometry) {
  Position displacement = GetDisplacement(&widget);
  geometry.x -= displacement.x;
  geometry.y -= displacement.y;

  if(gtkParent) gtk_fixed_move(GTK_FIXED(gtkParent), gtkWidget, geometry.x, geometry.y);
  unsigned width = (signed)geometry.width <= 0 ? 1u : geometry.width;
  unsigned height = (signed)geometry.height <= 0 ? 1u : geometry.height;
  gtk_widget_set_size_request(gtkWidget, width, height);
  if(widget.onSize) widget.onSize();
}
示例#2
0
文件: calculate.c 项目: wind1024/SWZ
/*
*****************************************************************************
**函 数 名:void MakeMessage(void)
**功能描述:数据处理
**输    入:  无
**输    出:  无
*****************************************************************************
*/
void MakeMessage(void)
{
	Uint8 xdata period = 0;
	Uint8 xdata statusWell;
	if(dataReady)
	{
		statusWell = JudgeWellStatus(GatDat->LoadBuff,TOTAL);    //判断负载(载荷)
		if(!statusWell)
		{
			period = GetCycle(GatDat->LoadBuff,TOTAL);
			if(period<70||period>120)
			{
				if(ParDat.TimeUnit <= 15 && SysDat.NumRegather<5)	
				{
					ReGather(period);
				}
				else 
				{					
					statusWell = 4;
					if(SysDat.NumRegather >= 5)	statusWell = 5;
					SysDat.NumRegather = 0;
					MakeOldFormatMsg();
				}
			}
			else
			{
				SysDat.NumRegather = 0;
//				if(timeUnit!=XBYTE[PERIOD_ADDR])
//					SaveToFlash(PERIOD_ADDR,0,&timeUnit,1);
				if(GetDisplacement(GatDat->AccInt,period))
				{
					MakeNewFormatMsg(period);
				}
				else
				{
					statusWell = 5;
					MakeOldFormatMsg();
				}
			}
		}
		else
		{
			MakeOldFormatMsg();
		}
		DISK_Write(DISK_OURDATA_ADDR,Msg.Head,sizeof(MESSAGE_DATA));
		dataReady = 0;
	} 
}
                /// Returns the arnold shader assigned to the procedural. This duplicates
                /// code in GeometryTranslator.h, but there's not much can be done about that
                /// since the GeometryTranslator isn't part of the MtoA public API.
                AtNode *arnoldShader(AtNode* node)
                {
                  m_displaced = false;

                  float maximumDisplacementPadding = -AI_BIG;
                  bool enableAutoBump = false;

                  unsigned instNumber = m_dagPath.isInstanced() ? m_dagPath.instanceNumber() : 0;
                  MPlug shadingGroupPlug = GetNodeShadingGroup(m_dagPath.node(), instNumber);

                  //find and export any displacment shaders attached
                  // DISPLACEMENT MATERIAL EXPORT
                  MPlugArray        connections;
                  MFnDependencyNode fnDGShadingGroup(shadingGroupPlug.node());
                  MPlug shaderPlug = fnDGShadingGroup.findPlug("displacementShader");
                  shaderPlug.connectedTo(connections, true, false);

                  // are there any connections to displacementShader?
                  if (connections.length() > 0)
                  {
                     m_displaced = true;
                     MObject dispNode = connections[0].node();
                     GetDisplacement(dispNode, maximumDisplacementPadding, enableAutoBump);
                     m_dispPadding = maximumDisplacementPadding;
                     AtNode* dispImage(ExportNode(connections[0]));

                     m_dispNode = dispImage;
                  }

                  // Only export displacement attributes if a displacement is applied
                  if (m_displaced)
                  {
                      std::cout << "arnoldShader::m_displaced :: " << m_displaced << std::endl;
                     // Note that disp_height has no actual influence on the scale of the displacement if it is vector based
                     // it only influences the computation of the displacement bounds
                    // AiNodeSetFlt(node, "disp_padding", maximumDisplacementPadding);
                  }

                  // return the exported surface shader
                  return ExportNode( shadingGroupPlug );
                }