15 #ifndef __GUI_DetailLook__
16 #define __GUI_DetailLook__
59 class gui_GeoInstanceInfo;
76 const char *detail_name = NULL,
77 SetDetailMode
mode = REFERENCE_DETAIL);
87 if (myRefCount.relaxedLoad() == 0)
91 virtual const char *className()
const;
96 const char *
getName()
const {
return myDetailName; }
97 void setName(
const char *
name);
105 OP_Node *getShopsRelativeTo()
const;
106 int getVisualizedNodeId()
const;
119 bool show_selections,
131 void updateForRender(
136 const char *view_name,
142 void updateForRenderInit(
147 const char *view_name,
157 void updateForRenderParallel(
162 const char *view_name,
180 { myMatUpdatePending =
up; }
182 {
return myMatUpdatePending; }
188 void reactivateRetired();
194 void getGeometryRenders(
198 void setSingleGeometryRender(
OP_Node *node);
199 void resetGeometryRender();
205 void clearSelectData();
206 bool hasSelectData()
const;
213 virtual bool isPickable()
const;
218 int & )
const {
return false; }
226 {
return drawLit() && !isWireframeOnly(); }
232 bool hasTransparency()
const;
235 bool hasReflectiveMaterial()
const;
243 virtual int getNumDetailHandles()
const;
246 virtual void appendDOPDataName(
UT_String &str,
int i,
247 bool descriptive)
const;
248 virtual const SIM_Data *getDOPData(
int i)
const;
249 virtual const SIM_RootData *getDOPRootData(
int i)
const;
250 virtual bool getIsDetailTempSelected(
int i)
const;
252 virtual UT_Vector4F getDetailPosition(
int i)
const;
259 void signalNodeSelectionChanged(
int i)
const;
261 virtual void setTempComponentSelection(
265 virtual void releaseAllTempComponentSelections();
268 { myEnableDOPDisplay = enable; }
270 {
return myEnableDOPDisplay; }
272 { myIsChosenDopnet = ischosen; }
274 {
return myIsChosenDopnet; }
276 bool hasUserSelection()
const;
279 { myUseNewLightInterface=i;}
281 {
return myUseNewLightInterface; }
282 void addObjLight(
int obj_light_id);
283 bool hasObjLight(
int obj_light_id)
const;
284 void removeObjLight(
int obj_light_id);
285 void clearObjLights();
289 void setLightArray(
RE_Light *lights[],
int nLights = 0);
294 void enableAllLights();
300 {
return myEnabledLights; }
303 static RE_Light *getGlobalHeadlight(
bool for_solaris=
false);
304 static RE_Light *getGlobalDomelight();
306 void setUseWireColor(
int c);
307 void setWireColor(
const UT_Color &clr);
313 {
return myWireColor; }
316 {
return myOutlineColor; }
321 { myXform = mat; myXformDirty =
true; }
323 {
return isObjSolo() ? (myXform*mySoloXform) :myXform; }
327 void setAllowShadingOpenCurves(
bool val);
329 {
return myFlag.shade_open_curves; }
331 void setDisplayAsSubdiv(
bool val);
338 if(!myFlag.overrideDisplay)
340 if(myFlag.display != display)
341 myDisplaySetDirty=
true;
342 myFlag.display = display;
349 { myFlag.shouldPick = picking; }
354 if(myFlag.templated!=templated)
355 myDisplaySetDirty=
true;
356 myFlag.templated = templated;
359 {
if(myFlag.footprinted!=footprint)
360 myDisplaySetDirty=
true;
361 myFlag.footprinted = footprint; }
363 { myDisplaySetDirty |= (myFlag.highlighted != highlight);
364 myFlag.highlighted = highlight; }
366 { myFlag.xray = xray; }
368 {
if(myFlag.targetoutput !=target_output)
369 myDisplaySetDirty=
true;
370 myFlag.targetoutput = target_output; }
371 void setCurrentOutput(
bool current_output);
372 void setDrawLit(
int onoff);
373 void setDrawCookComponentSelection(
bool enable);
375 void setSecondarySelection(
int onoff);
376 void setObjSelection(
bool obj_sel);
377 void setObjCurrent(
bool obj_current);
378 void setObjSelectionHint(
bool obj_sel_hint);
379 virtual void setObjGhost(
bool obj_ghost,
OP_Node *for_node);
381 bool setObjSolo(
bool solo,
const UT_Matrix4D *solo_transform=
nullptr);
386 { myFlag.wireframeOnly = wireframe_only; }
388 { myFlag.outline = outline; }
390 { myFlag.separateOutline =
b; }
392 { myFlag.beautyRender =
b; }
395 if(myFlag.active_model != active_model)
397 myDisplaySetDirty =
true;
398 myFlag.active_model = active_model;
408 static void setUVObject(
OP_Node *
object);
409 bool isUVObject()
const;
411 void setOnionSkinning(
int onion_skin_state);
421 { myFlag.use_frustum_culling = frust_cull; }
423 {
return myFlag.use_frustum_culling && !myFlag.onion_skin
424 && !myLastPointInstanceState &&
425 getUsesGeoRenderInstancing(); }
427 virtual void applyBundleToDisplayedObjects(
OP_Bundle *bdl,
int object_vis_change_count);
433 myFlag.prevDisplay = myFlag.display;
434 myFlag.display = onoff;
435 myFlag.overrideDisplay =
true;
440 myFlag.display = myFlag.prevDisplay;
441 myFlag.overrideDisplay =
false;
445 bool isDetailDisplayOn()
const;
457 virtual bool isXray()
const {
return myFlag.xray || myFlag.geoxray || myIsXRay; }
460 virtual bool isGuide()
const {
return false; }
461 virtual bool useWireColor(
int node_id)
const {
return myFlag.usewireclr; }
462 bool drawLit()
const {
return myFlag.drawLit; }
465 {
return myFlag.drawCookComponentSelection; }
485 {
return myInstanceUseTransform; }
488 {
return myFlag.needsAlphaPass; }
490 { myFlag.needsAlphaPass = e; }
500 if(myFlag.forceHidden != on)
502 myDisplaySetDirty=
true;
503 myFlag.forceHidden = on;
510 return myFlag.forceAsUVObject;
514 myFlag.forceAsUVObject = on;
520 if(myFlag.castShadows != on)
522 myDisplaySetDirty=
true;
523 myFlag.castShadows = on;
532 int showGroupColorVersion()
const;
533 void setShowGroupColorVersion(
int version);
537 int use_vertex)
const;
542 void invalidateBBox();
547 { myViewportMask =
mask; }
549 {
return myViewportMask; }
552 bool shownInViewport(
int viewport_id)
const;
553 void showInViewport(
int viewport_id);
554 void showInAllViewports();
557 int serial,
int serial2,
int id)
565 if(!myDisplaySetDirty)
567 return privGetDisplaySetType();
571 {
return privGetDisplaySetType(); }
591 ourChosenDopnetPath =
path;
595 ourChosenDopnetPath.clear();
600 return ourChosenDopnetPath.c_str();
605 auto len = ourChosenDopnetPath.length();
607 && !strncmp(ourChosenDopnetPath, path, len)
608 && (path[len] ==
':' || path[len] ==
'\0');
618 { myObjectLOD =
lod; }
620 void useObjectMaterials(
bool use_obj_mat);
624 { myFlag.showMaterials = show; }
626 {
return myFlag.showMaterials; }
631 { myFactoryMaterialGL = material; }
633 { myFactoryMaterial = material; }
636 {
return myFactoryMaterialGL || myFactoryMaterial; }
638 {
return myFactoryMaterialGL; }
640 {
return myFactoryMaterial; }
643 virtual bool isTimeDependent(
fpreal t);
644 bool areInstancesTimeDependent(
fpreal t);
656 static void setActiveViewport(
const char *
name,
int id);
658 static const char *getActiveViewport();
660 static int getActiveViewportId();
662 static const char *getActiveViewportMatString();
665 static void visibleViewportTypes(
bool view_3d,
bool view_2d);
666 static bool hasVisible3D();
667 static bool hasVisibleUV();
671 static int64 visibleUVAttribSerial();
673 enum { VIEW_3D = 0x1, VIEW_2D = 0x2 };
674 static void visibleViewportBoundaries(
677 UT_Array<std::pair<UT_StringHolder,int> > &uvs);
678 static bool hasVisibleBoundaries();
679 static bool visible3DBoundary();
683 &visibleUVBoundaries();
686 {
return myActiveVisualizers; }
688 {
return myActiveVisualizers.entries(); }
690 { myActiveVisualizers.append(vis_id);
691 myCollectVisPrimitives.append(0); }
694 myActiveVisualizers.clear();
695 myCollectVisPrimitives.clear();
698 {
return myCollectVisPrimitives(i); }
700 { myCollectVisPrimitives(i) = prim; }
703 void checkForErrors();
707 { myRedrawValue = redraw; }
709 {
if(myRedrawValue) myRedrawValue->changed(NULL); }
713 myFlag.visualizerCheck =
true;
714 myFlag.needVisualizerSetup =
false;
718 myFlag.visualizerCheck =
false;
719 myFlag.needVisualizerSetup = setup;
723 return (myFlag.needVisualizerSetup ||
724 myFlag.visualizerCheck);
730 {
return myContextMicroNode.get(); }
732 { myContextMicroNode = std::move(micronode); }
744 if (!record_viewport && !record_memory)
771 void cacheNodePtrs();
774 void initInstanceTable();
784 void finalizeInstanceTable();
788 bool createObjectInstance(
const char *instance_path,
791 gui_Instance &instance,
796 void removeDeletedGeos();
807 bool show_selections,
831 bool setupPointInstancing(
bool show_selections,
838 void updateInstancingStatus();
840 void checkGeoRenders();
843 void freeCachedDetails();
844 void freeDeletedCachedDetails();
846 int getNumOnionSkins()
const;
853 void clearOnionSkins();
855 class GUI_DetailLookFlags
858 GUI_DetailLookFlags()
871 targetoutput =
false;
872 currentoutput =
false;
875 drawCookComponentSelection =
true;
876 needsAlphaPass =
false;
878 secondarySelection =
false;
879 objSelection =
false;
881 objSelectionHint =
false;
883 wireframeOnly =
false;
885 separateOutline =
false;
888 prevShouldPick =
true;
889 overrideDisplay =
false;
890 displayAsSubdiv =
false;
891 shaders_used =
false;
892 active_model =
false;
893 being_deleted =
false;
894 shade_open_curves =
false;
896 onion_skin_deform =
false;
897 use_frustum_culling =
true;
898 errorsChecked =
false;
899 visualizerCheck =
false;
900 needVisualizerSetup =
true;
902 forceAsUVObject =
false;
903 showMaterials =
true;
908 isControlLook =
false;
909 forceTimeDep =
false;
930 drawCookComponentSelection:1,
933 secondarySelection:1,
952 use_frustum_culling:1,
955 needVisualizerSetup:1,
966 GUI_DetailLookFlags myFlag;
970 int myShowGroupColorVersion;
987 unsigned myObjTypeMask;
997 bool myUseNewLightInterface;
1003 unsigned int myViewportMask;
1004 bool myEnableDOPDisplay;
1005 bool myIsChosenDopnet;
1006 bool myNullDetailFlag;
1008 bool myInitializedFlag;
1009 bool myCopyDetailFlag;
1010 bool myDrawableFlag;
1012 mutable bool myDisplaySetDirty;
1015 fpreal myPrevInstanceFract;
1016 int myPrevInstanceLimit;
1017 int myInstanceFractSerial;
1018 int64 myPointInstanceVersion;
1019 int myInstanceXformVersion;
1021 int myInstanceObjectID;
1022 bool myHasInstancing;
1023 bool myHasPointInstancing;
1024 bool myInstanceUseTransform;
1025 bool myHasTransparentPrimitives;
1026 bool myLastPointInstanceState;
1027 bool myHasInstanceFile;
1033 int64 myOpErrorPosted;
1034 int64 myLookVersion;
1044 bool myCachingDetails;
1046 int64 myCacheSopSerial;
1048 bool myHasUnlitGeometry;
1050 bool myUpdatePending;
1051 bool myMatUpdatePending;
1052 bool myThreadedUpdatePending;
1056 exint myVisUpdateTime;
1059 exint myVisUpdateVersion;
1067 myCollectVisPrimitives;
1075 class gui_OnionSkinDetail
1079 : myDetail(dh), myRender(NULL), myUsedFlag(true)
1081 myDetail.addPreserveRequest();
1083 ~gui_OnionSkinDetail();
1089 typedef std::pair<exint,int64> gui_OnionSkinId;
1091 gui_OnionSkins myOnionSkins;
1093 class gui_OnionSkinLayer
1097 : myDetailID(id), myTime(t), myRender(NULL),
1098 myTransform(mat), myIsPreFrame(pre) {}
1100 gui_OnionSkinId myDetailID;
1108 class CachedDetailPos {
1116 CachedDetailPos(
const GU_Detail *detail)
1122 void computePosition(
const GU_Detail *detail)
1136 return myCacheCount == p.myCacheCount
1137 && myUniqueId == p.myUniqueId;
1162 return myNullDetailFlag ? 0 : 1;
1169 return myCachedObject;
1210 if((myFlag.display || myFlag.objOutput) && !myFlag.objHide)
1212 #if UT_ASSERT_LEVEL > 2
1227 bool changed =
false;
1228 if(myFlag.objSolo != solo)
1231 myFlag.objSolo = solo;
1233 if(solo && solo_transform)
1234 mat = *solo_transform;
1238 if(mat != mySoloXform)
1245 myXformDirty =
true;
static const char * getActiveViewportMatString()
static bool matchesChosenDopnetPath(const char *path)
virtual bool getUsesGeoRenderInstancing() const
int64 getNodeErrorID() const
void setTemplate(bool templated)
const UT_ValArray< RE_Light * > & getLights() const
void setPivot(const UT_Vector3F &pivot)
bool usesFrustumCulling() const
void materialUpdatePending(bool up)
OP_Node * getObject() const
bool isControlLook() const
bool getDetailDisplay() const
int getVersion(int version)
bool isSeparateOutline() const
void threadedUpdatePending(bool up)
void setForceAsUVObject(bool on)
bool getIsChosenDopnet() const
void useNewLightInterface(bool i)
void setNeedsAlphaPass(bool e)
void setCollectVisPrimitive(int i, GR_Primitive *prim)
int numActiveVisualizers() const
void setSnappable(int onoff)
bool getBBox(UT_BoundingBox *bbox, const GA_PrimitiveGroup *g=nullptr) const
UT_SharedPtr< GUI_GUSelectionProxy > GUI_GUSelectionProxyHandle
void setShowMaterials(bool show)
bool hasFactoryMaterialOverride()
bool setObjSolo(bool solo, const UT_Matrix4D *solo_transform=nullptr)
bool hasInstanceFile() const
bool useInstancerObjTransform() const
void setXform(const UT_Matrix4D &mat)
void setFactoryMaterialOverride(GR_MaterialPtr material)
bool isPointInstanced() const
void setObjTypeMask(unsigned mask)
bool forceAsUVObject() const
void setFootprint(bool footprint)
void setOutline(bool outline)
bool isDetailDisplayOn() const
bool isSymbolicGeometry() const
UT_IntrusivePtr< GUI_DetailLook > GUI_DetailLookPtr
GLsizei const GLchar *const * path
GA_API const UT_StringHolder rot
A collection of vertex arrays defining a geometry object. This class acts as a wrapper around multipl...
void setRedrawValue(UI_Value *redraw)
constexpr SYS_FORCE_INLINE T & z() noexcept
void setViewSerialNum(int num, int num_2d, int id)
void setForceHidden(bool on)
bool isInitialized() const
bool isFootprinted() const
bool isObjCurrent() const
bool isDrawableLook() const
UT_Vector4F getOutlineColor() const
virtual bool needsOverlayRender()
#define OP_INVALID_NODE_ID
OP_Network * getCreator() const
bool isWireframeOnly() const
GUI_DisplaySetType
Context specific display options for geometry states.
const UT_Set< int > & activeObjLights() const
Temporary container for either a RV_Render and an RE_Render.
int getVisualizedNodeId() const
void needVisualizerSetup(bool setup)
bool forceTimeDependent() const
virtual void setDisplaySavingPrevValue(int onoff)
virtual bool useWireColor(int node_id) const
IFDmantra you can see code vm_image_mplay_direction endcode When SOHO starts a render
void setHighlight(bool highlight)
std::unique_ptr< T, Deleter > UT_UniquePtr
A smart pointer for unique ownership of dynamically allocated objects.
void setIsDrawableLook(bool dr)
bool getEnableDOPDisplay() const
void setViewportMask(unsigned mask)
#define UT_ASSERT_MSG(ZZ,...)
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
UT_Matrix4D getXform() const
bool isThreadedUpdatePending() const
RE_MaterialPtr getFactoryMaterialOverrideGL()
virtual const PXL_Raster * getImage(RE_RenderContext)
const char * getFullPath(UT_String &str) const
void setPicking(bool picking)
virtual bool isGuide() const
void setGeometry(bool enable)
UT_Array< GUI_GeoRender * > myStashedGeoRenderShared
bool isBeautyRender() const
bool isSecondarySelection() const
void setCastShadows(bool on)
UT_Vector3T< T > center() const
bool showMaterials() const
void setIsControlLook(bool c)
bool isUpdatePending() const
const GR_CommonDispOption & common() const
static const UT_Matrix4T< fpreal > & getIdentityMatrix()
bool isMaterialUpdatePending() const
unsigned getObjTypeMask() const
void setObjectLOD(GEO_ViewportLOD lod)
GR_MaterialPtr getFactoryMaterialOverride()
virtual bool isDopGuide() const
UT_Array< GUI_SetupResult > myOnionSkinSetupResults
void setRender(bool render)
RE_Light * getLight(int i) const
bool isHighlighted() const
virtual void resetOverrideUsingSavedValue()
virtual bool hasPickPriority() const
void identity()
Set the matrix to identity.
virtual UT_Color getWireColor(int id) const
bool isOnionSkinning() const
GLuint const GLchar * name
void setContextMicroNode(UT_UniquePtr< DEP_MicroNode > &µnode)
virtual int getNumDetailHandles() const
void setBeautyRender(bool b)
GLboolean GLboolean GLboolean b
void setTargetOutput(bool target_output)
UT_Map< int, UT_Array< GUI_GroupDataHandle > > mySelectData
UT_SharedPtr< GU_Selection > GU_SelectionHandle
void setEnableDOPDisplay(bool enable)
bool isActiveModel() const
exint getUniqueId() const
GT_API const UT_StringHolder version
void setSeparateOutline(bool b)
virtual bool isXray() const
DEP_MicroNode * contextMicroNode()
GUI_DisplaySetType getDisplaySetType() const
UT_Array< GUI_GeoRender * > myGeoRender
GLfloat GLfloat GLfloat GLfloat h
static void setGlobalViewSerial(GUI_DisplayOption &disp, int serial, int serial2, int id)
GR_Primitive * getCollectVisPrimitive(int i)
virtual void setDetailDisplay(bool display)
unsigned int getViewportMask() const
bool useNewLightInterface() const
void setActiveModel(bool active_model)
OP_Node * getShopsRelativeTo() const
UT_Vector4T< fpreal32 > UT_Vector4F
void clearActiveVisualizers()
GA_API const UT_StringHolder up
bool needsAlphaPass() const
GEO_ViewportLOD getObjectLOD() const
GUI_API size_t format(char *buffer, size_t buffer_size, const GUI_DetailLook &v)
GA_GroupType
An ordinal enum for the different types of groups in GA.
bool isTargetOutput() const
SIM_API const UT_StringHolder position
void setXRayOverride(bool xray)
bool isObjSelectionHint() const
void setFactoryMaterialOverride(RE_MaterialPtr material)
int64 getMetaCacheCount() const
int64 getPrimDecorMask() const
void resetVisualizerCheck()
GA_API const UT_StringHolder pivot
void setOutputIndex(int index)
const UT_ValArray< RE_Light * > & getEnabledLights() const
bool drawCookComponentSelection() const
void updatePending(bool up)
static OP_Node * lookupNode(int unique_id, bool include_proxy=false)
void setIsChosenDopnet(bool ischosen)
bool runVisualizerSetup() const
static void setGlobalChosenDopnet(OP_Node *dopnet)
void useFrustumCulling(bool frust_cull)
std::pair< GUI_GeoRender *, bool > gui_CachedInstGeo
bool isOnionSkinDeformation() const
const UT_IntArray & getActiveVisualizers() const
const char * getName() const
PerfMonAutoMatEvent(const GUI_DetailLook &look)
UT_Array< GUI_GeoRender * > myOnionSkinRenders
bool isObjSelection() const
constexpr SYS_FORCE_INLINE T & y() noexcept
static const char * getGlobalChosenDopnetPath()
void setWireframeOnly(bool wireframe_only)
virtual bool getPickPriority(const GR_PickRecord &pick, int &) const
void setForceTimeDependent(bool v)
void setShowAxes(bool show_axes)
void setObjHidden(bool hide)
bool isCurrentOutput() const
UT_Array< GUI_SetupResult > mySetupResults
void appendActiveVisualizer(int vis_id)
GUI_DisplaySetType updateDisplaySetType()
void setObjOutput(bool output)
constexpr SYS_FORCE_INLINE T & x() noexcept
bool shadeOpenCurves() const